Hi,
I am stuck with this as I know a little vba but this is currently beyond my abilities. I basically am trying to have vba loop through a list of worksheets in the current workbook (WB1). The worksheet also exist on a different workbook (WB2-which is open). I need to use vlookup behind the scenes along with a custom function that returns the name of the sheet the cell is on. The vlookup will return for example [TABLE="width: 201"]
<tbody>[TR]
[TD="width: 201"]'[2014 Q1 Institutional.xlsm]Sheet1'![/TD]
[/TR]
</tbody>[/TABLE]
and will combine this with an & and a range in vba. This is the section I want to copy from WB2 to the same range in WB1. Please Help!!! Thanks in advance to one smarter than me.
I am stuck with this as I know a little vba but this is currently beyond my abilities. I basically am trying to have vba loop through a list of worksheets in the current workbook (WB1). The worksheet also exist on a different workbook (WB2-which is open). I need to use vlookup behind the scenes along with a custom function that returns the name of the sheet the cell is on. The vlookup will return for example [TABLE="width: 201"]
<tbody>[TR]
[TD="width: 201"]'[2014 Q1 Institutional.xlsm]Sheet1'![/TD]
[/TR]
</tbody>[/TABLE]
and will combine this with an & and a range in vba. This is the section I want to copy from WB2 to the same range in WB1. Please Help!!! Thanks in advance to one smarter than me.
Code:
Sub test()
Dim found As Range
Dim ws As Worksheet
For Each ws In Worksheets
With ws
Select Case .Name
Case "a","b","c"
(Application.VLookup(Application.SheetName(B6), "Hierarchy!$Q$2:$R$100", 2, 0) & "E89:W90").value
End Select
End With
Next
End Sub