I am trying to use excel VBA to enter a formula in a cell. I am doing it by, using the formula, Cells(x,y) = "='Additional Expenses'!" + CStr(Cname)
. Where Cname will the name of the cell(i,j), So that the variable Cname has a name like: "A1" , "G5",etc. So, is there any formula I can use to change the value of Cname to the name of the cell??
Cname= cells (i,j).address 'where i is a row number , j is column.
will give values like "$A$1" in a string variable type.
and later on, Range (Cname)
, will refer to exactly the same as writing cells(i,j)
.
and if you need to know , i = Range(Cname).row
, and j = Range(Cname).Column
, to get it reversed.
Hope this helps you out.