Hi all,
I have a code which adds two new sheets ws2 and ws3 by the following script
Dim ws2 As Worksheet: Set ws2 = Sheets.Add
and it works fine.
I wrote a macro which adds all sort of formulas in both ws2 and ws3
But when I wanted to add formula to ws3 looking up values in ws2, the macro was unable to find the sheet ws2. I tried putting brackets around ws2 in the below code too, but the macro would not just locate ws2.
With ws3.Range("E4:E" & LastRow)
.Formula = "=VLOOKUP(A4,ws2!A:C,3,FALSE)"
End With
Please advise!
Thanks
I have a code which adds two new sheets ws2 and ws3 by the following script
Dim ws2 As Worksheet: Set ws2 = Sheets.Add
and it works fine.
I wrote a macro which adds all sort of formulas in both ws2 and ws3
But when I wanted to add formula to ws3 looking up values in ws2, the macro was unable to find the sheet ws2. I tried putting brackets around ws2 in the below code too, but the macro would not just locate ws2.
With ws3.Range("E4:E" & LastRow)
.Formula = "=VLOOKUP(A4,ws2!A:C,3,FALSE)"
End With
Please advise!
Thanks