Hi Everyone, trying to edit this code. Rather than having X as a set file, I'd like to change it to the Active Sheet when the macro was ran.
Sub WIP_CopyDataToTemplate()
Dim x As Workbook
Dim y As Workbook
Set x = Workbooks.Open("C:\Users\jh\Desktop\Adaptive Files\1M21 WIP by Contract.xls") 'Copying book
Set y = Workbooks.Open("C:\Users\jh\Documents\Operational Finance\Upload Actuals\WIP Template TESTING.xlsm") 'path to destination book
'Transfer X to Y:
y.Sheets("Surety WIPS").Range("B3:B5000").Value = x.Sheets("Sheet1").Range("AB11:AB5008").Value ' Copy Contract Numbers
'y.Sheets("Surety WIPS").Range("C3:C5000").Value = x.Sheets("Sheet1").Range("AM11:AM5008").Value
'y.Sheets("Surety WIPS").Range("D3:AB5000").Value = x.Sheets("Sheet1").Range("B11:Z5008").Value
Close x:
x.Close
End Sub
I thought I could simply do Set x = ActiveSheet, but this did not work. Any suggestions?
Bookmarks