View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Use Offset in formula

Hi,

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address(0, 0) & ",
""mm/dd"")"

note the addition of (0,0 after the address

Mike

"Alex" wrote:

This is perfect except that I need the address to be relative.

"Mike H" wrote:

Alex,

If I've understood correctly then try this

ActiveCell.Formula = "=Text(" & ActiveCell.Offset(, 1).Address & ",
""mm/dd"")"

Mike

"Alex" wrote:

I'm trying to write a formula in a cell, =Text(B1, "mm/dd") where B1 is the
cell to the right of the cell I'm writing the formula in. Am I at all close
with the following? It's not working. Thanks for your help.

Selection.Formula = "=TEXT(Offset(rowOffset:=0, columnOffset:=1),"mm/dd")"