How do I find the number of used columns in an Excel sheet using VBA?
Dim lastRow As Long lastRow = Sheet1.Range(\"A\" & Rows.Count).End(xlUp).Row MsgBox
This is the answer:
numCols = objSheet.UsedRange.Columns.count
Documentation of the UsedRange property