VBA: Count the Number of Used Columns
The following code will return in a message box the total number of columns used in a worksheet. Empty columns are considered used if data follows the empty column.
MsgBox ActiveSheet.UsedRange.Columns.Count
Can't get the tutorial to work for you? Need help with your code?
Get answers right away at our AE Excel Support Forums!
Get answers right away at our AE Excel Support Forums!



I am automatinmg some spread sheet that are for calculations
Public Sub CountMyColumns()
MsgBox Selection.Columns.Count
End Sub