Excel VBA: how to convert column number to letters

Who I am
Martí Micolau
@martimicolau
Author and references
 

You're working with Excel in VBA is you're trying to convert the column number to letters but you don't know how to go on? Don't worry, keep reading and I'll explain how to do it.

The operation is very simple, all you have to do is call the function indicated below: ConvertToLetter passing as a parameter the number of the column you already know.


If you don't know where to start, go on Development in Excel (in the top menu) and click on Record Macro and in the small window that appears click on OK.


Immediately after click on the top Stop Recording and press the icon VISUAL BASIC.

In the window that opens, on the left click on Module 1 and add in the right window inside Sub Macro1 () the code to call the ConverToLetter function (in practice copy the code below).

Coltesto = ConvertToLetter (NumCol)  'NumCol is the number of the column you are passing through.

Add immediately after this command:

Msgbox Coltesto  'you will need it to see the column letter

After End Sub di Macro1() copy and paste the function below:

Function ConvertToLetter(byval iCol As Integer) As String
   Dim iAlpha As Integer
   Dim iRemainder As Integer
   iAlpha = Int(iCol / 27)
   iRemainder = iCol – (iAlpha * 26)
   If iAlpha > 0 Then
      ConvertToLetter = Chr(iAlpha + 64)
   End If
   If iRemainder > 0 Then
      ConvertToLetter = ConvertToLetter & Chr(iRemainder + 64)
   End If
End Function



You will need it to convert the column number to letters.

Good Luck!

Adriana gil We are a specialized and passionate team of virtual reality. We have extensive experience in this area. We decided to create ForVirtualRealityLovers to share all our information with customers and users. We have quality information. You can find tips, guides, interviews, top products and much more! If you are curious, enter our site ForVirtualRealityLovers.com and discover the virtual world! 😉 Excel: how to solve the message "Privacy warning: this document contains macros, ActiveX controls .." ❯

Articles related to

How to apply Pagination in ASP
Best gaming mouse 2021: which one to buy
How to color alternate rows in Excel
How to configure XDebug on Netbeans with Wamp and Xampp
Javascript: how to use pdfObject to view PDF files
How to reduce the size and weight of an image
Add Comment from Excel VBA: How to Convert Column Number to Letters
Comment sent successfully! We will review it in the next few hours.

Software

  • Windows starts slow
  • Best programs to uninstall on Windows 10
  • What to do if the hard drive makes strange noises
  • How to fill out a CV and look for work on the web
  • How to merge two Excel cells
  • How to create a news binder on your site
  • How to download and clone an entire website
  • What slows down a PC
  • How to recover lost files with Wondershare Data Recovery
  • Best free burning program
  • How to recover a corrupt PST file
  • WinX DVD Ripper Platinun: The best DVD Ripper for DVD to digital conversion
  • How to back up your data
  • Excel: how to solve the message "Privacy warning: this document contains macros, ActiveX controls .."
  • How to record PC screen with PowerPoint
  • How to insert the Developer tab in Excel
  • How to shrink the log file on all databases
  • Read and write files in ASP
  • How to compare two PDF files
  • Div Css or Tables? pros and cons
❤️Chi Sleep For Virtual Reality Lovers?

For Virtual Reality Lovers we are a team of people who aim to give you all the best information about Virtual Reality.


What information do we share?

We share everything you need to know about virtual reality, tips, prices, features, guides and much more !.

🤖What are the best virtual reality products?

We have the best information section on the best virtual reality products.


This work is under a Creative Commons Attribution-Non-Commercial-No Derivatives 4.0 International License. 2021/primerpaso.me X

Check out our best articles!

Programs to delete undeletable files

How to compare two text files

Programs to delete unnecessary files

How to download and clone an entire website

add a comment of Excel VBA: how to convert column number to letters
Comment sent successfully! We will review it in the next few hours.