Refer to column as AA rather than column 26

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
I'm using a Select Case statements with the Select Case ActiveCell.Column to get the number. The each case has the number to have that code take effect.

Is there a way to allow me to use the Case statements such as CASE "AA".

Its not hard to get the column number, but it would be easier to use column header label rather than the column number. It would also make the code easier to read.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,150
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
I'm using a Select Case statements with the Select Case ActiveCell.Column to get the number. The each case has the number to have that code take effect.

Is there a way to allow me to use the Case statements such as CASE "AA".
Try this as your Select Case statement...

Select Case ActiveCell.EntireColumn.Address(0, 0)

Then your Case statement could be this...

Case "A:A"
 
Upvote 0

mark hansen

Well-known Member
Joined
Mar 6, 2006
Messages
534
Office Version
  1. 2016
Platform
  1. Windows
Thanks for the quick reply Rick, that helps a lot. It will allow me and others to read and under the code easier and add additional Case statements when we need to expand to additional rows.
 
Upvote 0

Forum statistics

Threads
1,191,001
Messages
5,984,091
Members
439,872
Latest member
noaman79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top