Hi All,
I'm using this snippet of code to define a cell that changes depending on how the user specifies a couple different parameters.
Then, I'm using the following bit of code to insert a function into the spreadsheet using the matchcell string in place of a relative cell reference.
Here, I've manually inserted the "$" character before the string "matchcell" to define a cell reference where the column is fixed, but the row is not. Is there a way to fix the row reference and not the column reference with the string variable and address function? Or, is there even a way to manually insert the "$" character so that the macro inserts a formula with a fixed row reference?
I'm using this snippet of code to define a cell that changes depending on how the user specifies a couple different parameters.
Code:
Dim matchcell As String
matchcell = Sheets("Control").Cells(LastRow1 * 2 - 2, 1).Address(0, 0)
Then, I'm using the following bit of code to insert a function into the spreadsheet using the matchcell string in place of a relative cell reference.
Code:
With Sheets("Control").Cells(LastRow1 * 2 - 2, 2)
.Formula = _
"=INDEX(Data1,MATCH($" & matchcell & ",Dates,0),COLUMN())*INDEX(Data2,MATCH($" & matchcell & ",Weights,0),COLUMN())"
.NumberFormat = "0.0%"
.HorizontalAlignment = xlRight
End With
Here, I've manually inserted the "$" character before the string "matchcell" to define a cell reference where the column is fixed, but the row is not. Is there a way to fix the row reference and not the column reference with the string variable and address function? Or, is there even a way to manually insert the "$" character so that the macro inserts a formula with a fixed row reference?