View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Writing a formula in code

sformlua = "=VLOOKUP(C" & activecell.row & _
",DatabaseData!A:B,2)"

--
Regards,
Tom Ogilvy


"Crystal" wrote in message
...
I'm writing a macro that will loop through the cells in a
selection and apply a formula only to the cells whose
backcolor is 36. The loop works fine.

When I hardcode the formula in: "=VLOOKUP(C9,DatabaseData!
A:B,2)" the cell reference to "C9" does not change as a
relative reference would. How to I get the cell reference
in A1 notation by using ActiveCell? I need the name of
the active cell (D9) minus one column to produce (C9).

Any suggestions would be greatly appreciated.