Copy Paste range from one workbook sheet to another if the sheet names given on another book

paulcherianc

New Member
Joined
Jul 28, 2016
Messages
6
I need to copy paste a particular range let's say Range("Y:AK") from one workbook to another workbook's worksheet if the sheet names are matching with the names mentioned on my macro workbook.
I will be running this macro from macro workbook. So there will be 3 different workbook opened.
I have started coding as follows but dont know how to loop it based on the sheet names mentioned on my macro workbook.


VBA Code:
Sub Openfiles()

' This macro run from my macro book



Dim wbBook1 As Workbook 'This is my macrobook
Dim wbActu As Workbook    'This is my workbook from where i need to copy range
Dim wbResult As Workbook 'This is my workbook from where i need to paste range


'Just trying to open the files from the workbook path given on my macro book.
Set wbBook1 = ThisWorkbook
Set wbActu = Workbooks.Open(Range("B1").Value)
ThisWorkbook.Activate ' As i dont know how to open both files together i have coded like this.
Set wbResult = Workbooks.Open(Range("B2").Value)


' Now here onwards the macro should search for the sheet names mentioned on the macrofile workbook sheet named "menu" and from B3 till down.

'?


End Sub

Can any one help me!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top