Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In article ,
Tom Hutchins wrote: The best idea I have had so far is to set a MARKER (a named range) just after the last row of data when the workbook is opened. Store its row nujmber in a global variable. Then, in the Change event for the worksheet in question (Sheet1, for example), compare the current row of the MARKER cell to its previous row. This lets you know if any (and how many) rows were added or deleted. Wow... very clever! One minor problem: Selection has to be on the current sheet, so if the sheet of interest is not the first one, the sequence that sets the MARKER to the last cell on the sheet:- Range(FindLastCell(Sheets("NotSheet1"))).Offset(1, 0).Select ActiveWorkbook.Names.Add Name:="MARKER", RefersToR1C1:=Selection ....sets MARKER to a position on Sheet1, setting you up for a crash when you try to insert a row on NotSheet1. This can be corrected by avoiding Selection: ActiveWorkbook.Names.Add Name:="MARKER", _ RefersToR1C1:=Range(FindLastCell(Sheets("RefData") )).offset(1, 0) Nonetheless, I am very impressed by your insight into the problem. Thanks! Tony |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I "insert copied cells"? used to be "alt i e" still work | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F | Excel Discussion (Misc queries) | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) | |||
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc | Excel Programming |