Is there a way to detect the number of IN USE rows and columns in a spreadsheet?
Printable View
Is there a way to detect the number of IN USE rows and columns in a spreadsheet?
An EXCEL spreadsheet that is.
Looping through them in the following manner may do it. I'm assuming your wanting some VBA and not wanting to do this from a VB application :-)
While Not Worksheets(MySheet).Cells(x + i, y + j) = ""
'put a loop count here
Wend
"IN USE"?
As in being selected/highlighted? The Range.Areas returns the range being selected (including multiple-selection)
As in -- having a value? -- I think you can use the IsEmpty() function in VBA.
Set RangeToChek = ActiveCell.CurrentRegion
RangeToChek.Rows.Count -> will give you the Max Row
RangeToChek.Columns.Count -> will give you the Max Column
Please Note that there should not be any Blank Column or A Row in between.
This works in Macros,
This should work. I've not tried. You may please verify.
Good Luck