SpecialCells method to find Last Used Column in worksheet
Sub LastUsedColumn_SpecialCells_1()
Dim lastColumn As Integer
lastColumn = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Column
MsgBox lastColumn
End Sub
Sub LastUsedColumn_SpecialCells_2()
Dim lastColumn As Integer
lastColumn = ActiveSheet.Range("A1").SpecialCells(xlCellTypeLastCell).Column
MsgBox lastColumn
End Sub
Comments
Post a Comment
jeetexceltips@gmail.com