one way i've usde as long as i know i have headers for each column:
Sub test()
Dim ws As Worksheet
Dim lastcol As Long
Dim lastrow As Long
Dim arr As Variant
Dim i As Long
Set ws = Worksheets("Sheet1")
lastcol = ws.Cells(1, Columns.Count).End(xlToLeft).Column
ReDim arr(1 To lastcol)
For i = 1 To lastcol
arr(i) = ws.Cells(Rows.Count, i).End(xlUp).Row
Next
lastrow = Application.Max(arr)
End Sub
--
Gary
"Bob" wrote in message
...
Hi All:
I have two questions that are sort of related.
1-I was wondering is anyone knows in excel, how we could know, the last
row
and column on the spreadhseet that has any data in it?
2- Let's say that you have data on the Range A1:A20, and A1000. At this
point the vertical scroll bar is very small. Then if you delete A1000, is
there a way to reset the limits on the vertical scroll bar? In the
regular
VB, you have Scrolbar.min and scrolbar.max. Is there such a thing in VBA
for
Excel?
Thanks for your help.
Bob