Hi Team,
I got stuck below in highlighted Bold line. please assist.
getting object doesn't support error. Actually I want to open a existing workbook, by pasting its file path in
sheet1.range("b5").value (i.e MacroBook). after that I want to set it and would like to use the variable in looping.
plz check and assist. Thanks.
Sub Test()
Dim wbk As Workbook
Dim ws1 As Worksheet
Dim ws As Worksheet
Dim lr As Long
Set wbk = Workbooks.Open(Sheet1.Range("B5").Value)
Set ws1 = wbk.Worksheet
For Each ws In Worksheets
Select Case ws.Name
Case "A", "B", "C"
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
ws.Range("B2:B" & lr).Formula = "=VLOOKUP(A2,Thisworkbook.sheet2!A1:B7,2,false)"
End Select
Next ws
End Sub
I got stuck below in highlighted Bold line. please assist.
getting object doesn't support error. Actually I want to open a existing workbook, by pasting its file path in
sheet1.range("b5").value (i.e MacroBook). after that I want to set it and would like to use the variable in looping.
plz check and assist. Thanks.
Sub Test()
Dim wbk As Workbook
Dim ws1 As Worksheet
Dim ws As Worksheet
Dim lr As Long
Set wbk = Workbooks.Open(Sheet1.Range("B5").Value)
Set ws1 = wbk.Worksheet
For Each ws In Worksheets
Select Case ws.Name
Case "A", "B", "C"
lr = ws.Cells(Rows.Count, "A").End(xlUp).Row
ws.Range("B2:B" & lr).Formula = "=VLOOKUP(A2,Thisworkbook.sheet2!A1:B7,2,false)"
End Select
Next ws
End Sub