If your last column is 34 and you want the name of that column then Why (LastCol - 1)? why not (lastcol)? I can answer the question but i want you to understand the logic... try the code if you want. Also understand what the function ReturnName() does...So to call you function in VBA, which is what I am doing it would be..
visual basic code:ColLetters = ReturnName(LastCol - 1)
Did you see my edit on the last post?
On a humorous note try this![]()
VB Code:
Private Sub CommandButton1_Click() 'last col no Colno = 34 MsgBox "Which is the one that you want: " & ReturnName(Colno) & " or " & ReturnName(Colno - 1) End Sub
Hope this helps....




Reply With Quote