Is there a simple way to determine the number of rows and columns in a workbook? It's hard to specify the range if I don't know the maximum number of rows and columns that I can work with.
Any help is appreciated.
ljCharlie
Is there a simple way to determine the number of rows and columns in a workbook? It's hard to specify the range if I don't know the maximum number of rows and columns that I can work with.
Any help is appreciated.
ljCharlie
Hello ljCharlie,
If you are interested in the maximum size of a Worksheet, there are 65,536 Rows and 256 Columns. You can also use VBA to return this information as well.
Code Example of Max Rows and Columns:
With ActiveSheet
MaxRows = .Rows.Count
MaxCols = .Columns.Count
End With
If you want to know the maximum size of the Worksheet based on what Rows and Columns that contain data, use the VBA Worksheet property UsedRange.
Example of Finding Rows and Columns with Data:
With ActiveSheet.UsedRange
FirstRow = .Row
FristCol = .Col
LastRow = .Rows.Count + FirstRow - 1
LastCol = .Columns.Count + FirstCol - 1
End With
Hope this answers your question,
Leith Ross
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks