Hello, I am trying to make a macro that will essentially copy several different cells from one workbook to another. I used the macro recorder and it gave me the following code: (I attempted to add in the variable)
Essentially, What I am looking to do is use cell C4 on sheet Extra! to reference what document the data is to be pulled from. In cell Extra!C4, I have 201400001.xlsx with no brackets or anything in it. I have this cell auto updating everytime I run the macro so that when I manually "loop" the macro,it will auto increment the cell +1 so that it will open the next numbered workbook in sequence.
Summary:
I need a variable to replace [201400001.xlsx] in the above code with a cell reference to Extra!C4 so that I can use this cell to dictate what document to open.
Thanks in advance for the help
erock1357
Code:
Sub DoAllTheThings()
'
' DoAllTheThings Macro
'
Dim eVariable1 As Integer
eVariable1 = "Extra!C4"
ActiveCell.FormulaR1C1 = "=eVariable1 & Invoice!R6C8"
ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R7C8"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R11C2"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R32C9"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R33C9"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R34C9"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R35C9"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R36C9"
'ActiveCell.Offset(0, 1).Select
'ActiveCell.FormulaR1C1 = "=[201400001.xlsx]Invoice!R38C9"
'ActiveCell.Offset(1, -8).Select
End Sub
Essentially, What I am looking to do is use cell C4 on sheet Extra! to reference what document the data is to be pulled from. In cell Extra!C4, I have 201400001.xlsx with no brackets or anything in it. I have this cell auto updating everytime I run the macro so that when I manually "loop" the macro,it will auto increment the cell +1 so that it will open the next numbered workbook in sequence.
Summary:
I need a variable to replace [201400001.xlsx] in the above code with a cell reference to Extra!C4 so that I can use this cell to dictate what document to open.
Thanks in advance for the help
erock1357