Excel VBA – delete a single column…

This is a function to delete a specific column based on the Column letter and Row number.

e.g. DeleteSingleColumn(“A”, 1), then Column A will be completely deleted

Function DeleteSingleColumn(ByVal validColumn As String, ByVal StartRow As Long)

Dim i As Long
Dim DelString As String

DelString = validColumn & StartRow


End Function

Excel VBA – How to convert Column Number into Column Letter?

This is a function, to convert the Column in number into the Column Letter, in order to work with most Range, functions in VBA, the Column Letter will be very useful than the Column number.

e.g. Column “A” = Column number 1

Column “C” = Column number 3

Function ConvertToLetter(ByVal iCol As Integer) As String

If iCol <= 26 Then
‘ Columns A-Z
ConvertToLetter = Chr(iCol + 64)
End If

If iCol > 26 Then
‘ Column label greater than Z, going into AA…
ConvertToLetter = Chr(Int((iCol – 1) / 26) + 64) & Chr(((iCol – 1) Mod 26) + 65)
End If

End Function