Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Set Numbers cell background color using AS with targeted cell based on selected cell

Modifying “Changing background colors of cells in mac numbers” that is here: Changing background colors of cells in ma… - Apple Community


Can this AppleScript be adopted to work with the current cell selected rather than the selection be based on a range?


Posted on Mar 22, 2023 11:15 AM

Reply
Question marked as Top-ranking reply

Posted on Mar 22, 2023 1:59 PM

I thought I had misunderstood your question. Maybe the piece of code below will help to get you started. It replaces the first part of the code provided by SGIII (and it is basically from another script of his). It is a handy little snippet of code to have around when you want to write a script that does something to a selected range of cells.


tell application "Numbers"
	tell front document's active sheet
		tell (first table whose selection range's class is range)
			set selRange to selection range
			repeat with c in selRange's cells
				set c's background color to my hexColortoRGB("#143C23")
			end repeat
		end tell
	end tell
end tell


6 replies
Sort By: 
Question marked as Top-ranking reply

Mar 22, 2023 1:59 PM in response to BernSh

I thought I had misunderstood your question. Maybe the piece of code below will help to get you started. It replaces the first part of the code provided by SGIII (and it is basically from another script of his). It is a handy little snippet of code to have around when you want to write a script that does something to a selected range of cells.


tell application "Numbers"
	tell front document's active sheet
		tell (first table whose selection range's class is range)
			set selRange to selection range
			repeat with c in selRange's cells
				set c's background color to my hexColortoRGB("#143C23")
			end repeat
		end tell
	end tell
end tell


Reply

Mar 22, 2023 2:07 PM in response to Badunit

Perfect, works just as I need. Thank you!


And let me add that I'm crystal clear no one is obligated in any way to answer questions in this forum and that giving your time and attention is pure generousity and a gift. That's closer to what I mean by the simple much used 'Thank you' 🫡

Reply

Set Numbers cell background color using AS with targeted cell based on selected cell

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.