You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Automating a copy function in numbers

Can I add a button a person would click on in my number project that would automatically copy cells C17:C21 to the clipboard?


Posted on Feb 16, 2021 6:39 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 26, 2021 5:19 PM

There are no "buttons" in Numbers. You could write an AppleScript that would do something to a table. If saved as a Service, you could assign a keyboard shortcut to invoke it. A script could be written to put the current time in a selected cell (select the cell, invoke the script, the time is placed in the selected cell). A script could also be written to put the current time into a specific cell of a specific table (invoke the script and the time is placed in cell A2 of the table named "CurrentTime", if such table exists). A script could be written do do more specific actions but the more specific it gets, the less useful the script will be in general.


One drawback about scripts is they are not part of the document. If others use your spreadsheet on their own computers, they would need the same script (saved as a service) and assign it a keyboard shortcut.



The first script mentioned is below. If it is of interest, we can show how to turn it into a service and assign a keyboard shortcut to it


-- INSERT DATE AND TIME
-- Numbers script
-- Inserts the current date and time into a selected Numbers app cell or 
-- into all selected cells of a range of cells

tell application "Numbers"
	tell front document's active sheet
		tell (first table whose selection range's class is range)
			set value of cells in selection range to (current date) as Unicode text
		end tell
	end tell
end tell

5 replies
Question marked as Top-ranking reply

Feb 26, 2021 5:19 PM in response to Dancin_Brook

There are no "buttons" in Numbers. You could write an AppleScript that would do something to a table. If saved as a Service, you could assign a keyboard shortcut to invoke it. A script could be written to put the current time in a selected cell (select the cell, invoke the script, the time is placed in the selected cell). A script could also be written to put the current time into a specific cell of a specific table (invoke the script and the time is placed in cell A2 of the table named "CurrentTime", if such table exists). A script could be written do do more specific actions but the more specific it gets, the less useful the script will be in general.


One drawback about scripts is they are not part of the document. If others use your spreadsheet on their own computers, they would need the same script (saved as a service) and assign it a keyboard shortcut.



The first script mentioned is below. If it is of interest, we can show how to turn it into a service and assign a keyboard shortcut to it


-- INSERT DATE AND TIME
-- Numbers script
-- Inserts the current date and time into a selected Numbers app cell or 
-- into all selected cells of a range of cells

tell application "Numbers"
	tell front document's active sheet
		tell (first table whose selection range's class is range)
			set value of cells in selection range to (current date) as Unicode text
		end tell
	end tell
end tell

Feb 27, 2021 5:42 AM in response to Badunit

Thanks again Badunit.


Yep. Select a cell, the cell data entry button shows up, and insert current date or time is an option.


If the field is formatted for both date and time you’ll get both (by inserting either date or time).


The Mac version has a keyboard shortcut that’s easy if you know it (and can modify it).


I’m just looking to make it one button easy, obvious and foolproof.


I like using the available free apps, instead of buying a specialized apps for things like time tracking, but making some things easier and obvious would be a bonus.

Automating a copy function in numbers

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