I need to copy a set of data from one excel file to anoter. I am writing the code (vba) in file A and need to copy the data from file B to file A. I wrote the below code, its opening the file B and copying it but is not pasting it in file B which i open already. Need help...
Function transfer()
Dim wbk As Workbook
FirstFile = "D:\P.xls"
FinalFile = "D:\late.xlsm"
Set wbk = Workbooks.Open(FirstFile)
With wbk.Sheets("CIP")
Range("A2:A90").Select
Selection.Copy
End With
Set wbk = Workbooks.Open(FinalFile)
With wbk.Sheets("All data")
Range("A2").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
End Function
Function transfer()
Dim wbk As Workbook
FirstFile = "D:\P.xls"
FinalFile = "D:\late.xlsm"
Set wbk = Workbooks.Open(FirstFile)
With wbk.Sheets("CIP")
Range("A2:A90").Select
Selection.Copy
End With
Set wbk = Workbooks.Open(FinalFile)
With wbk.Sheets("All data")
Range("A2").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
End Function