If you want the last used cell in a particular column, you can use:
dim LastRow as long
with worksheets("sheet1")
lastrow = .cells(.rows.count,"A").end(xlup).row
end with
If you can trust the usedrange (excel may not think it's the same as you
think--it remembers if you've used a cell and then cleared it).
Dim LastRow As Long
With Worksheets("sheet1").UsedRange
LastRow = .Cells(.Cells.Count).Row
End With
Debra Dalgleish has some techniques at:
http://www.contextures.com/xlfaqApp.html#Unused
to reset that lastused cell.
=======
Included in Debra's site is code that can find the last cell with something in
it:
Dim LastRow As Long
Dim LastCol As Long
With Worksheets("sheet1")
LastRow = 0
LastCol = 0
On Error Resume Next
LastRow = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByRows).Row
LastCol = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByColumns).Column
On Error GoTo 0
End With
MsgBox LastRow & vbLf & LastCol