Good afternoon,
I have the following code:
I am looking to make amendments to the code.
Providing that you are working will ROW 1 in 'workbook x':
Path to destination book is the same each time, but the filename of the destination workbook is not.
The filename of the source workbook is chosen from a drop-down list in cell B1 within 'workbook x'.
Where "sheetname" is the value from the drop-down list in cell B1 within 'workbook x'.
For example purposes, path where B1 data is stored is "C:\Examplefolder"
Save and close workbook x.
I then want all of the above codes applied to all rows.
Any help/suggestions greatly appreciated.
Best regards
manc
I have the following code:
Code:
Sub copypasteworkbook()
Dim x As Workbook
Dim y As Workbook
Dim vals as Variant
'## Open both workbooks first:
Set x = Workbooks.Open(" path to copying book ")
Set y = Workbooks.Open(" path to destination book ")
'Store the value in a variable:
vals = x.Sheets("name of sheet").Range("A1").Value
'Use the variable to assign a value to the other file/sheet:
y.Sheets("sheetname").Range("A1").Value = vals
'Close x:
x.Close
End Sub
I am looking to make amendments to the code.
Providing that you are working will ROW 1 in 'workbook x':
Code:
Set y = Workbooks.Open(" path to destination book ")
The filename of the source workbook is chosen from a drop-down list in cell B1 within 'workbook x'.
Code:
'Use the variable to assign a value to the other file/sheet:
y.Sheets("sheetname").Range("A1").Value = vals
For example purposes, path where B1 data is stored is "C:\Examplefolder"
Code:
'Close x:x.Close
I then want all of the above codes applied to all rows.
Any help/suggestions greatly appreciated.
Best regards
manc