simongilder
Board Regular
- Joined
- Nov 3, 2011
- Messages
- 68
Hi,
Please could you help with the code below, I am very new to VBA
I want to open a file whose filepath and name are determined in A1 of Sheet1. Then I want to copy the entire sheet "S1" from the newly opened workbook back to the original workbook, and paste values to a Sheet called "dump".
This seems to work fine, but I cannot get the source file to close afterwards.
Any help would be gratefully received.
Thank you.
Simon
Dim strFName As String
strFName = Sheet1.Range("A1").Value
Workbooks.Open Filename:=strFName
Worksheets("s1").Range("a1:AZ1000").Select
Selection.Copy
ThisWorkbook.Activate
ActiveWorkbook.Sheets("Dump").Activate
Range("A1").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Please could you help with the code below, I am very new to VBA
I want to open a file whose filepath and name are determined in A1 of Sheet1. Then I want to copy the entire sheet "S1" from the newly opened workbook back to the original workbook, and paste values to a Sheet called "dump".
This seems to work fine, but I cannot get the source file to close afterwards.
Any help would be gratefully received.
Thank you.
Simon
Dim strFName As String
strFName = Sheet1.Range("A1").Value
Workbooks.Open Filename:=strFName
Worksheets("s1").Range("a1:AZ1000").Select
Selection.Copy
ThisWorkbook.Activate
ActiveWorkbook.Sheets("Dump").Activate
Range("A1").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False