Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
Thanks a lot...
Alex. Nitulescu |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
Do you mean:
Columns("G").Select OR: Columns("G:G").Select Instead of: Columns(7).Select Or something else? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
No, I was referring to something like
Columns("My wonderful new caption") instead of Columns(4), or Columns("G")... |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
Hello Radu, Put your caption in Row 1. Select the Column by clicking the column letter. Click *Insert* on the menu bar and select *Name*. Check that the entire column is selected. Look at the *Refers to:* box. If you selected column "G" on sheet 1 you will see "=Sheet1!$G:$G". The double column letter indicates the entire column is selected. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=492248 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
Thank you, Ross.... What I need is this:
In a module (VBA code) I need to be able to refer to columns in my spreadsheet not by position, since the user might change the columns' order, but by Caption (the caption is NOT negociable). So in the first row I have the captions, like Caption 1 Caption 2 Caption 3 and in the subsequent rows I have the data: a b c d e f I need to be able to write in code NOT .Columns(2), NOT columns ("B"), since the columns might move, but .Columns("Caption 2")... Radu |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I refer (in VBA Code) to a column by caption instead of index ?
Record a macro while doing this:
Select your columns InsertNameCreate check Top row Include this in your code Now you can refer to the columns: ..Range("Caption2") -- Kind regards, Niek Otten "Radu" wrote in message oups.com... Thank you, Ross.... What I need is this: In a module (VBA code) I need to be able to refer to columns in my spreadsheet not by position, since the user might change the columns' order, but by Caption (the caption is NOT negociable). So in the first row I have the captions, like Caption 1 Caption 2 Caption 3 and in the subsequent rows I have the data: a b c d e f I need to be able to write in code NOT .Columns(2), NOT columns ("B"), since the columns might move, but .Columns("Caption 2")... Radu |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I refer to other macros inside a macro code? | Excel Programming | |||
How to refer to a cell format code? | Excel Discussion (Misc queries) | |||
Refer to Worksheet Ranges in Code | Excel Programming | |||
More then 1 Excel object running at same time , how can I refer to right one in code? | Excel Programming | |||
refer to the sheets Name property in my code (not what is on the Tab) | Excel Programming |