Hello there.
I've got some code here (done with some of your help) to find the last row on a worksheet. What I have been trying to do is to now select and copy rows 1 through to the "last row". And I can't bloody make it work! Normally you'd select Rows 1:25 or whatever, but I just can't work out where and how exactly to put it all together. I'm eventually going to paste it to another sheet and reformat it, which I can handle, but of course this one stupid bit which should be easy has me stumped. So can anyone tell me how (and where to put!) code which will select (and copy) rows 1:endof list. I am feeling quite inept at the moment. As specific as you can get will not go astray.
Here's what we have so far:
Sub FindLastRow()
Dim lastrow As String
Dim EndofList As String
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching back from 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
Thanking you!!!
I've got some code here (done with some of your help) to find the last row on a worksheet. What I have been trying to do is to now select and copy rows 1 through to the "last row". And I can't bloody make it work! Normally you'd select Rows 1:25 or whatever, but I just can't work out where and how exactly to put it all together. I'm eventually going to paste it to another sheet and reformat it, which I can handle, but of course this one stupid bit which should be easy has me stumped. So can anyone tell me how (and where to put!) code which will select (and copy) rows 1:endof list. I am feeling quite inept at the moment. As specific as you can get will not go astray.
Here's what we have so far:
Sub FindLastRow()
Dim lastrow As String
Dim EndofList As String
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching back from 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
Thanking you!!!