Im looking for a VB way to convert a column letter to a number.
Does anyone have a function that can do this or some code i can adapt?
Im looking for a VB way to convert a column letter to a number.
Does anyone have a function that can do this or some code i can adapt?
Try this.
![]()
Please Login or Register to view this content.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
This looks like it converts a number to a letter im asfter the other way around letter to number
With VBA code you usually do not need to convert column letters to numbers as there is usually a way to utilize letters or numbers within your commands
commands like cell(rownumber,columnnumber or columnletter)
Why do you need to convert column letters to numbers
This is some code I used years ago that converts letters to numbers & a 2nd macro that converts numbers to letters. I used this when I was just starting out coding in Excel VBA in the early days of Excel 5 and have not used it since
They are constructed as functions to be called from another macro
![]()
Please Login or Register to view this content.
' Convert Column Number to Letter (from Col A to ZZ)![]()
Please Login or Register to view this content.
' ****************************************************************
![]()
Please Login or Register to view this content.
Last edited by mudraker; 03-25-2008 at 10:00 AM.
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
Hi,
I needed to do the same. My solution follows (legend: s = string with a letter or two which denote the column, a = integer representing 1st letter, b = integer representing the second letter):
Hope it helps.![]()
Please Login or Register to view this content.
![]()
w.
If anyone else looking for a solution to this problem: I believe there are easier, most likely more efficient ways to do both things:
To convert the column letter to the column number you could use:
![]()
Please Login or Register to view this content.
To convert the column number to the column letter you could use:
![]()
Please Login or Register to view this content.
As an Excel workbook always needs to contain at least one visible worksheet, these two functions will always work correctly and very efficient.
Best regards,
Philip
And another way
![]()
Please Login or Register to view this content.
Hope this helps
If you need any more information, please feel free to ask.
However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....
Also
اس کی مدد کرتا ہے اگر
شکریہ کہنے کے لئے سٹار کلک کریں
If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.
one ot he fastes way ro do it
![]()
Please Login or Register to view this content.
This is an old thread and should be locked and archived.
Ben Van Johnson
Or maybe put into an FAQ section.
I found it helpful.
A simple way to go either way:
Number to letter:
Letter to number:![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks