Hello experts,
I am using the data mining tools from MS. One of the tools gives me a table of data. I need to expand what the table provides.
Therefore, I want to copy the formula they give me, modify it and then paste to another cell. I tried the =GetFormula UDF but still couldn't get what I need.
I am using VLOOKUP for now.
I created a macro. I copy the cell referenced usnig a Const.
I change the cell reference as I only need to do this for the columns, not the rows.
I'll have approximately 10 of these.
Instead of the sheet name being hardcoded, I would like to reference it, but I cannot figure out how to do this.
This way, when the sheet name changes, which it will, i want to change it once in the Const referenced instead of all of the times it is hardcoded.
Is there a way to do this?
Perhaps I am just getting the syntax wrong?
Const SheetNameHere as string = "SheetNameTest1"
Sub Test()
ActiveWorkbook.Activate
Range(RangeName1).Select
Selection.Copy
Range(RangeName1).Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP('SheetNameHere'!R16C2, 'SheetNameHere'!R35C15:R63C16, 2, FALSE)"
Application.CutCopyMode = False
End Sub
Thanks for any help or advice you can offer.
I am using the data mining tools from MS. One of the tools gives me a table of data. I need to expand what the table provides.
Therefore, I want to copy the formula they give me, modify it and then paste to another cell. I tried the =GetFormula UDF but still couldn't get what I need.
I am using VLOOKUP for now.
I created a macro. I copy the cell referenced usnig a Const.
I change the cell reference as I only need to do this for the columns, not the rows.
I'll have approximately 10 of these.
Instead of the sheet name being hardcoded, I would like to reference it, but I cannot figure out how to do this.
This way, when the sheet name changes, which it will, i want to change it once in the Const referenced instead of all of the times it is hardcoded.
Is there a way to do this?
Perhaps I am just getting the syntax wrong?
Const SheetNameHere as string = "SheetNameTest1"
Sub Test()
ActiveWorkbook.Activate
Range(RangeName1).Select
Selection.Copy
Range(RangeName1).Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP('SheetNameHere'!R16C2, 'SheetNameHere'!R35C15:R63C16, 2, FALSE)"
Application.CutCopyMode = False
End Sub
Thanks for any help or advice you can offer.