Public Function CLetter(v As Long) As String
If ActiveWorkbook Is Nothing Then
Application.ScreenUpdating = False
Workbooks.Add
CLetter = Left(Cells(1, v).Address(1, 0), InStr(1, Cells(1, v).Address(1, 0), "$") - 1)
ActiveWorkbook.Close
Application.ScreenUpdating = True
Else
CLetter = Left(Cells(1, v).Address(1, 0), InStr(1, Cells(1, v).Address(1, 0), "$") - 1)
End If
End Function
Public Function CNumber(v As String) As Integer
If ActiveWorkbook Is Nothing Then
Application.ScreenUpdating = False
Workbooks.Add
CNumber = Range(v & "1").Column
ActiveWorkbook.Close
Application.ScreenUpdating = True
Else
CNumber = Range(v & "1").Column
End If
End Function
Sub EnterColumnLetters()
Dim CLL As Range
Range("1:2").Insert
Range("1:2").NumberFormat = "@"
For Each CLL In Rows(1).Cells
CLL = CLetter(CLL.Column)
CLL.Offset(1, 0) = CNumber(CLL.Text)
Next CLL
End Sub
|