Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last record in macro and delete all after
How do I design a macro to find the last record in a report and delete each
row after. Keeping in mind that the cell reference can change to where the last record is found??? Help please!!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last record in macro and delete all after
If it is the last record, then what is being deleted. If there is something
different from records, in the sheet, then how do you distinguish a record from other data. if the address of the last record is known (assume it is A132 lastRecordAddress = "A123" Range(lastRecordAddress, "A65535").Offset(1,0).EntireRow.Delete -- Regards, Tom Ogilvy "Sherife" wrote in message ... How do I design a macro to find the last record in a report and delete each row after. Keeping in mind that the cell reference can change to where the last record is found??? Help please!!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last record in macro and delete all after
Thanks for being so quick! I have to add information to an invoice so with
each invoice the last record changes and that's why I need it to find the last record and then delete the added information after that. I add the extra information to several cells in a column so that if more records come in month to month that information flows down the page far enough to match each additional record "Tom Ogilvy" wrote: If it is the last record, then what is being deleted. If there is something different from records, in the sheet, then how do you distinguish a record from other data. if the address of the last record is known (assume it is A132 lastRecordAddress = "A123" Range(lastRecordAddress, "A65535").Offset(1,0).EntireRow.Delete -- Regards, Tom Ogilvy "Sherife" wrote in message ... How do I design a macro to find the last record in a report and delete each row after. Keeping in mind that the cell reference can change to where the last record is found??? Help please!!! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last record in macro and delete all after
assume the data starts in F3
Sub Cleanup() Dim rng as range set rng = Range("F3") if isemtpy(rng) then exit sub if not isblank(Range("F3").Offset(1,0)) then set rng = rng.End(xldown)) rng.offset(1,0).Resize(100,10).Clearcontents end if end sub Since your description was extremely general, adjust the above to suit your specific situation -- Regards, Tom Ogilvy "Sherife" wrote in message ... Thanks for being so quick! I have to add information to an invoice so with each invoice the last record changes and that's why I need it to find the last record and then delete the added information after that. I add the extra information to several cells in a column so that if more records come in month to month that information flows down the page far enough to match each additional record "Tom Ogilvy" wrote: If it is the last record, then what is being deleted. If there is something different from records, in the sheet, then how do you distinguish a record from other data. if the address of the last record is known (assume it is A132 lastRecordAddress = "A123" Range(lastRecordAddress, "A65535").Offset(1,0).EntireRow.Delete -- Regards, Tom Ogilvy "Sherife" wrote in message ... How do I design a macro to find the last record in a report and delete each row after. Keeping in mind that the cell reference can change to where the last record is found??? Help please!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to find and record Unique values? | Excel Discussion (Misc queries) | |||
find last record in macro and delete all after | Excel Discussion (Misc queries) | |||
how to get a macro to record F2, Home, Delete keystrokes | Excel Programming | |||
Macro to delete record and validation problem | Excel Programming | |||
delete record using Macro in excel spreed sheet | Excel Programming |