in Numbers how to delete all entries below a certain row
in "Numbers" how to delete all data entries below a selected row?
in "Numbers" how to delete all data entries below a selected row?
Select a cell in the leftmost column of the first row from which you want to delete content.
Scroll to the last row of the table, then command-click in the rightmost cell of that row to expand the selection to ALL cells between the two selected cells.
With all cells in that block now selected. press Delete.
Regards,
Barry
Select a cell in the leftmost column of the first row from which you want to delete content.
Scroll to the last row of the table, then command-click in the rightmost cell of that row to expand the selection to ALL cells between the two selected cells.
With all cells in that block now selected. press Delete.
Regards,
Barry
Here is a revised script for the "Clear Data" shortcut. It has a different take on the meaning of "clear data". Hopefully I covered all bases.
tell application "Numbers"
tell front document to tell active sheet
tell (first table whose selection range's class is range)
--set selRng to selection range
repeat with aCell in (get selection range)'s cells
try
tell aCell
if its formula is not missing value then
--do nothing if it is a formula
else if its format is rating then
-- set ratings to zero
set its value to 0
else if its format is checkbox then
-- uncheck checkboxes
set its value to false
else if its format is slider or its format is stepper then
-- set slider and stepper values to min value
set its value to -1.0E+308
else if its format is pop up menu then
-- clear popups but leave them as pop ups
-- would like to set them to their "start with" value but do not know how
set p1 to properties of aCell
set value of aCell to ""
set format of aCell to p1
else
-- clear numbers, durations, text, dates
set its value to ""
end if
end tell
end try
end repeat
end tell
end tell
end tell
Assuming you mean you want to delete the contents of cells that have data in them while leaving alone all cells that have formulas, take a look at SGIII's response in this thread:
In numbers I want to delete cell content … - Apple Community
Install the shortcut. Select the rows/cells you want to clear then run the shortcut. Cells with formulas will be left alone. All others will be cleared of their data.
EDIT: I noticed just now that the shortcut does not remove date values or text entries. I see in the AppleScript why that happens but I do not know why SGIII wrote it that way.
My comment was perhaps poorly worded. Part of the "is it data" test was to multiply the value by 1 and see if it equals the value. Text and dates fail that test, leaving them un-cleared when they, too, are data. That was the part I did not understand. Clearing everything else made sense.
My rewrite of the script was to cover how I myself would "clear" cells that had pop-ups and other structured data entry formats. I would want the format to remain, but reset to a default value.
The wording was fine. The original short and snappy script was written back sometime in the 2010s. The problem then, if I remember correctly, was a user had some cells/rows with input numbers and some with formulas, as one might see in a financial statement. So how to clear out the numbers easily while leaving the formulas in the range intact?
For me that has been by far the most common use. I've never had a reason to automate further. I don't tend to intermingle cells with different Data Formats, so manual clearing is quick and easy. I haven't gotten much into sliders and steppers and all that. Probably should.
Anyway, thanks for your helpful enhancements! I've "borrowed" them.😀
SG
I figured out how to set a pop up to the "start with" value. I had a mistake in my code. I should have been saving and later restoring the cell's format.
tell application "Numbers"
tell front document to tell active sheet
tell (first table whose selection range's class is range)
--set selRng to selection range
repeat with aCell in (get selection range)'s cells
try
tell aCell
if its formula is not missing value then
--do nothing if it is a formula
else if its format is rating then
-- set star ratings to zero
set its value to 0
else if its format is checkbox then
-- uncheck checkboxes
set its value to false
else if its format is slider or its format is stepper then
-- set slider and stepper values to min value
set its value to -1.0E+308
else if its format is pop up menu then
-- set pop up menus to their "start with" value
set f1 to format of aCell
set value of aCell to ""
set format of aCell to f1
else
-- clear numbers, durations, text, dates
set its value to ""
end if
end tell
end try
end repeat
end tell
end tell
end tell
Badunit wrote:
I do not know why SGIII wrote it that way.
To keep things simple!
I generally don't need the added features, but many others may find them helpful. Thanks!
SG
in Numbers how to delete all entries below a certain row