Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default refernce header text in code

vb novice

in my code currently, i am using (1,3) format for cell ref in things like
Offset, etc.
What i would like to do is have the column not be based on a number, but the
header text in row 5.

in other word when b8 is active cell then the offset would be (0, and
whatever column contains "Invoice #" in header row 5.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default refernce header text in code

Hi

If you have the header "Invoice #" in column D I would use something like:

cells(ActiveCell.Row, "D")

Hopes this helps.

---
Per

"KUMPFfrog" skrev i meddelelsen
...
vb novice

in my code currently, i am using (1,3) format for cell ref in things like
Offset, etc.
What i would like to do is have the column not be based on a number, but
the
header text in row 5.

in other word when b8 is active cell then the offset would be (0, and
whatever column contains "Invoice #" in header row 5.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default refernce header text in code

Thanks, but the reason i wanted to ref header text is because it is always
going to be in the column that i want my form to place the user entries, no
matter if columns are added or deleted around it. IOW, if i later insert a
column in front of say "C" then "Invoice #" is no longer in "D", but "E".

"Per Jessen" wrote:

Hi

If you have the header "Invoice #" in column D I would use something like:

cells(ActiveCell.Row, "D")

Hopes this helps.

---
Per

"KUMPFfrog" skrev i meddelelsen
...
vb novice

in my code currently, i am using (1,3) format for cell ref in things like
Offset, etc.
What i would like to do is have the column not be based on a number, but
the
header text in row 5.

in other word when b8 is active cell then the offset would be (0, and
whatever column contains "Invoice #" in header row 5.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default refernce header text in code

Then we have to look at named ranges.

Select the cell containing the header "Invoice #" and goto Insert Name
Define : Name the cell "Invoice" Ok

Now you can reference to the cell using Range("Invoice"), so the answer to
our provious question will be:

iCol = Range("Invoice").Column
Cells(ActiveCell.Row, iCol) = "Hello"

Hopes this helps

---
Per

"KUMPFfrog" skrev i meddelelsen
...
Thanks, but the reason i wanted to ref header text is because it is always
going to be in the column that i want my form to place the user entries,
no
matter if columns are added or deleted around it. IOW, if i later insert
a
column in front of say "C" then "Invoice #" is no longer in "D", but "E".

"Per Jessen" wrote:

Hi

If you have the header "Invoice #" in column D I would use something
like:

cells(ActiveCell.Row, "D")

Hopes this helps.

---
Per

"KUMPFfrog" skrev i meddelelsen
...
vb novice

in my code currently, i am using (1,3) format for cell ref in things
like
Offset, etc.
What i would like to do is have the column not be based on a number,
but
the
header text in row 5.

in other word when b8 is active cell then the offset would be (0, and
whatever column contains "Invoice #" in header row 5.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop through code and refernce text file for info Sabosis Excel Discussion (Misc queries) 1 September 21st 11 01:40 AM
Using IF to refernce another cell Hamed parhizkar Excel Programming 2 June 24th 08 06:39 PM
Omit header from first page without embedding header in code ibvalentine Excel Worksheet Functions 6 August 28th 07 05:10 AM
Circular Refernce Kamal Excel Discussion (Misc queries) 1 February 27th 07 04:07 PM
Range refernce question... jayklmno Excel Programming 4 September 20th 06 10:19 PM


All times are GMT +1. The time now is 11:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"