Hi guys!
Wanted to copy data values from one workbook to another in a worksheet column wise I came up with the following code and it is working
But now i want to copy data row wiseSub copy() Dim wbMain As Workbook Dim wbData As Workbook Set wbMain = ActiveWorkbook Set wbData = Workbooks.Open("C:\Users\Naveed\Desktop\Excel Project\Test\Data.xlsx") wbData.Sheets(1).Range("A1:A5").copy wbMain.Sheets(1).Range("A1:A5").PasteSpecial End Sub
for instance values in the data workbook is stored on a range B21, C21, D21, E21..... up to AF21. how to copy that range to the Main workbook.
To answer your question... yes I have two different workbooks, Main and Data. Main has the button on its sheet(1) and i want to copy data from sheet(1) on workbook Data
my attempt
But every time I run the code it shows the dotted rectangle around the range how to remove it?'source copy range wbData.Sheets(1).Range("B21:AF21").Copy 'destination paste range wbMain.Sheets(1).Range("B1").PasteSpecial xlPasteValues
Any help would be appreciated
BR