I have a sheet Rolling Plan in copy.xls worksheet.I want to copy it to Book1.xls worksheet in Sheet NO1 in Range A1:H6
The macro in Book.xls
Sub CopytoPS()
Dim sfil As String
Dim owbk As Workbook
Dim sPath As String
sPath = "C:\Users\Nirmala\Desktop\website" 'Change the file path for your purposes
sfil = Dir(sPath & "copy.xls")
Range("B6:H6").Copy
Set owbk = Workbooks.Open(sPath & sfil)
owbk.Sheets("RollinPlan").Range("B6:H6").End(xlUp).Offset(1, 0).
PasteSpecial xlPasteValues
owbk.Close True 'Save opened workbook and close
sfil = Dir
End Sub
This does the following:
1) Open
copy.xlsand copy data in rangeB6:H62) Pastes the data into workbook
Book1in rangeA1:H6on sheetNO1Note that I am not quite sure why the data range you are copying to (i.e.
A1:H6) is much larger than the actual copied range (i.e.B6:H6).