ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing a cell, not the value (https://www.excelbanter.com/excel-programming/331781-referencing-cell-not-value.html)

BerkshireGuy[_2_]

Referencing a cell, not the value
 


I have the following line in some VBA:

objSht.Cells(Row, "U").Formula = "=477" & "* Q" & Row & ""

This line basically sets the formula for all of column U for as many
rows as there are. It works great.

However, suppose if I had a worksheet called "Data" and in that
worksheet I had a cell lets say B1 and in that cell is the 477 figure.


How can I make this dynamic? Meaning, if the user changes the 477 to
577, I want all of the formulas referencing that cell to update
properly?


Thanks,
Brian


jjk

Referencing a cell, not the value
 
Try this.

objSht.Cells(Row, "U").Formula = "=Data!$B$1" & "* Q" & Row & ""

Regards,
Jayant


TomHinkle

Referencing a cell, not the value
 
I'm hoping you've just been looking at it too long

objSht.Cells(Row, "U").Formula = "=" & objsht.Range("B5").value & " & "*
Q" & Row & ""


"BerkshireGuy" wrote:



I have the following line in some VBA:

objSht.Cells(Row, "U").Formula = "=477" & "* Q" & Row & ""

This line basically sets the formula for all of column U for as many
rows as there are. It works great.

However, suppose if I had a worksheet called "Data" and in that
worksheet I had a cell lets say B1 and in that cell is the 477 figure.


How can I make this dynamic? Meaning, if the user changes the 477 to
577, I want all of the formulas referencing that cell to update
properly?


Thanks,
Brian



BerkshireGuy[_2_]

Referencing a cell, not the value
 
Awesome!

This newbie thanks you!

-Brian



All times are GMT +1. The time now is 10:48 PM.

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