![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
How can I write a macro to select the last row with data and then go to the next row? I’ve tried to records a macro where I do that, but it just goes to the last row with data and then says “Range("A59").Select”, where A59 just so happens to be the next row in that case but it won’t work once I’ve added or deleted a data row.
THANKS! |
|
|
|
|
|
#2 |
|
New Member
Join Date: Feb 2002
Posts: 10
|
Sub FindLastRow()
If WorksheetFunction.CountA(Cells) > 0 Then 'Search for any entry, by searching backwards by Rows. lastrow = Cells.Find(What:="*", After:=[A1], _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious).Row End If EndofList = lastrow Range("A1").Select ActiveCell.Offset(EndofList, 1).Range("A1").Select End Sub |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
Range("A65536").End(xlUp).Offset(1, 0).Select Regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|