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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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
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,214,787
Messages
6,121,558
Members
449,038
Latest member
Guest1337

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
Back
Top