ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing a formula in code (https://www.excelbanter.com/excel-programming/276172-re-writing-formula-code.html)

Tom Ogilvy

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.





All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com