PDA

View Full Version : vba copy paste



tinamishra
10-17-2019, 10:36 PM
there are 2 files opened
in 1st file i will place vba code
and there is one more file which is opened
copy the data of that file and paste the data in a vba placed file
and close that file
keep vba placed file open with that data

大灰狼1976
10-18-2019, 01:58 AM
Hi tinamishra!
Something like this:

Sub CopyThat2This()
Dim wb1 As Workbook, wb2 As Workbook
Set wb1 = ThisWorkbook
Set wb2 = Workbooks("That") 'enter what you want
wb2.Sheets(1).[a1:x100].Copy wb1.Sheets(1).[a1]
wb2.Close False
Set wb1 = Nothing
Set wb2 = Nothing
End Sub

--Okami