Hello Friends
Could some one please check what is wrong with the following code; I am getting error message that script is out of range
Workbooks(strSourceFile).Sheets("DataSheet").Range("A1:G1").Copy Workbooks(strFileName).Worksheets("Sheet1").Range("A1")
strSourceFile and strFileName are variable file names declated as strings.
This line is part of a larger code that I am trying to make work. I did not post the complete code because I thought that would be confusing. As you may see from the code that I am trying to copy first row (Columns A to G) from the workbook strSourceFile and paste it to another workbook strFileName.
In the code both the variables (strSourceFile and strFileName) have complete path for the files.
Thanks for your time
Rajesh
Could some one please check what is wrong with the following code; I am getting error message that script is out of range
Workbooks(strSourceFile).Sheets("DataSheet").Range("A1:G1").Copy Workbooks(strFileName).Worksheets("Sheet1").Range("A1")
strSourceFile and strFileName are variable file names declated as strings.
This line is part of a larger code that I am trying to make work. I did not post the complete code because I thought that would be confusing. As you may see from the code that I am trying to copy first row (Columns A to G) from the workbook strSourceFile and paste it to another workbook strFileName.
In the code both the variables (strSourceFile and strFileName) have complete path for the files.
Thanks for your time
Rajesh