Results 1 to 20 of 24

Thread: get column letter

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #18
    VBAX Newbie
    Joined
    Jul 2014
    Posts
    2
    Location
    Brute force approach...
    try:
                 Public Function GetColumnAddr(ByVal cellAddr As String, ByVal keepAbs As Boolean) As String
                   Dim idx As Long
                   Dim str As String
                   Dim curChar As String
                   
                   If cellAddr = "" Then
                     GetColumnAddr = ""
                     Exit Function
                   End If
                   
                   idx = 1
                   str = "" ' not necessary but ...
         
                   If Left(cellAddr, 1) = "$" Then 
                   idx = 2
                   if keepAbs then str = "$"
                  End If
         
                   curChar = Mid(cellAddr, idx, 1)
                   While (Not IsNumeric(curChar)) And (curChar <> "$")
                     str = str & curChar
                     idx = idx + 1
                     curChar = Mid(cellAddr, idx, 1)
                   Wend
                   
                   GetColumnAddr = str
                   
                 End Function
    Last edited by PMBottas; 07-20-2014 at 01:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •