Hi All,
I would like to fined out how many columns and rows i have in my spread sheet in my excel.
I tried to get it with
wksheet.Columns.count
but it gave me all the columns and not only the one that are filled.
thank - Lin.
Printable View
Hi All,
I would like to fined out how many columns and rows i have in my spread sheet in my excel.
I tried to get it with
wksheet.Columns.count
but it gave me all the columns and not only the one that are filled.
thank - Lin.
These little loops will find how many rows and columns you have used. Hope it helps....
Code:Sub CountRows()
Dim Counter As Integer
oXLApp.Worksheets("Sheet1").Select
Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Counter = Counter + 1
Loop
End Sub
Code:Sub CountColumns()
Dim Counter As Integer
oXLApp.Worksheets("Sheet1").Select
Range("A1").Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 1).Select
Counter = Counter + 1
Loop
End Sub
thanks allot for your help :)