
Originally Posted by
kstv
both file needs to by opened and ctrl+g from zip_code_validator to launch the form.
stephen
It is confusing for me to read your long code
therefore, I just make a sample sub (see in module 2) that makes the same result as your need, I hope you can understand what it run and correct it appropriated to your problem,
see the sub in module 2 from attached file,
Sub sample()
Dim WbSource As Workbook, WbDestination As Workbook
Dim WsSource As Worksheet, WsDestination As Worksheet
Dim RgnSource As Range, RgnDestination As Range
Dim ColSearch As Long, ColGet As Long
Set WbSource = Workbooks("zip_code_validator.xlsm") 'ActiveWorkbook
Set WsSource = WbSource.Sheets("zip")
Set RgnSource = WsSource.Range("A1:M151")
Set WbDestination = Workbooks("project_file.xlsx")
Set WsDestination = WbDestination.Sheets("Sheet1")
Set RgnDestination = WsDestination.Range("B2:B15")
'SetValue RgnDestination, ColSearch, RgnSource, ColGet
ColSearch = 6: ColGet = 2
With RgnDestination
.FormulaR1C1 = _
"=VLOOKUP(RC" & ColSearch & ",[" & WbSource.name & "]" & WsSource.name & "!" & _
RgnSource.Address(, , xlR1C1) & "," & ColGet & ",0)"
.Value = .Value
End With
End Sub
Bookmarks