Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
I have the following line in my macro code:
KeyCell = ActiveCell.Address This is used in the line: Range("D2").Formula = "=IF('Original Data'!" & KeyCell & "<0,'Original Data'!" & KeyCell & ",TODAY())" It evaluates fine but, further down in my code, I copy this formula down a large number of rows. Unfortunately, KeyCell is an absolute cell reference and I want it to be relative. What do I need to do to change this? Many thanks for your help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
KeyCell = ActiveCell.Address(0,0)
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Ladymuck" wrote in message ... I have the following line in my macro code: KeyCell = ActiveCell.Address This is used in the line: Range("D2").Formula = "=IF('Original Data'!" & KeyCell & "<0,'Original Data'!" & KeyCell & ",TODAY())" It evaluates fine but, further down in my code, I copy this formula down a large number of rows. Unfortunately, KeyCell is an absolute cell reference and I want it to be relative. What do I need to do to change this? Many thanks for your help |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
KeyCell = ActiveCell.Address(False, False)
the first optional variable is row absolute the second is column. This makes both relative -- Charles Chickering "A good example is twice the value of good advice." "Ladymuck" wrote: I have the following line in my macro code: KeyCell = ActiveCell.Address This is used in the line: Range("D2").Formula = "=IF('Original Data'!" & KeyCell & "<0,'Original Data'!" & KeyCell & ",TODAY())" It evaluates fine but, further down in my code, I copy this formula down a large number of rows. Unfortunately, KeyCell is an absolute cell reference and I want it to be relative. What do I need to do to change this? Many thanks for your help |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
I think you need to make KeyCell = ActiveCell.Address(RowAbsolute:=False,
ColumnAbsolute:=False) This way the dollar signs are not returned, and when you go to copy it wil advance the references. Hope this helps, Keith "Ladymuck" wrote: I have the following line in my macro code: KeyCell = ActiveCell.Address This is used in the line: Range("D2").Formula = "=IF('Original Data'!" & KeyCell & "<0,'Original Data'!" & KeyCell & ",TODAY())" It evaluates fine but, further down in my code, I copy this formula down a large number of rows. Unfortunately, KeyCell is an absolute cell reference and I want it to be relative. What do I need to do to change this? Many thanks for your help |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
Why are you using activecell to begin with? Wouldn't an absolute address be
better here? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Change cell reference type
Thanks for your suggestions, they work brilliantly.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Shortcut to change change cell reference to Absolute reference? | Excel Worksheet Functions | |||
change the reference type of multiple formulas | Excel Discussion (Misc queries) | |||
change the reference type of multiple formulas | Excel Discussion (Misc queries) | |||
change change cell reference to Absolute reference | Excel Discussion (Misc queries) | |||
How do I locate a highlighted cell as a cross hair type reference | Setting up and Configuration of Excel |