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.
Can any one help me!
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!