ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vlookup in different sheets and workbooks (https://www.excelbanter.com/excel-programming/401556-vlookup-different-sheets-workbooks.html)

Faboboren

Vlookup in different sheets and workbooks
 
Hi,

I want to repeat this vlookup in 3 sheets and 11 files. I am tryng also the
vlookup bring some number from other file, and I have problems with the code.

Thanks

Sub Vlookupsheets()

With Sheets("sheet2")
If IsEmpty(.Cells(.Rows.Count, 1)) Then
Set rngResults = .Range(.Cells(7, 13), _
.Cells(.Rows.Count, 1).End(xlUp).Offset(0, 12))
Else: Set rngResults = .Range(.Cells(7, 13), _
.Cells(.Rows.Count, 14))
End If
Set rngLookupValue = .Cells(7, 1)
End With

With rngResults
.Formula = "=IF(ISNA(VLOOKUP(" & _
rngLookupValue.Address(False, False) & _
",Plano!A&P plano!A:N,14,FALSE)),2,VLOOKUP(" & _
rngLookupValue.Address(False, False) & _
",Plano!A&P plano!A:N,14,FALSE))"
.Value = .Value
End With

End Sub


All times are GMT +1. The time now is 11:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com