Get row number from a closed workbook
I am trying to get the row number, where the criteria meets a certain value
I have been trying with this code:
Code:
Dim wkb As Workbook
Dim a As Range
Dim clientwks As Worksheet
Dim listrange As String
Dim foundValue As Range
Dim fundet As Integer
Dim clientlist As Range
Dim listen As Range
Set wkb = Workbooks.Open("Q:\KUNDER\PROJEKTER\HPG\HPG_DB.xlsx")
Set clientwks = wkb.Sheets("Template_0")
Set clientlist = clientwks.Range("A1")
listrange = "PRO123456"
Set listen = Range("A1", Range("A1").End(xlDown))
For Each a In listen
Set foundValue = clientlist.Cells.Find(listrange)
If Not foundValue Is Nothing Then
a.Offset(0, 0).Value = foundValue.Row
End If
Next a
Get row number from a closed workbook
Paul - that worked great!!! My code looked like yours except...I was missing two pieces of punctuation.
Your GOOD code
Code:
f = "=Iferror(match(""" & s & """,'Q:\KUNDER\PROJEKTER\HPG\[HPG_DB.xlsx]" & MachID & "'!$A:$A,0),""not found"")"
My BAD code
Code:
f = "=Iferror(match(""" & s & """,'Q:\KUNDER\PROJEKTER\HPG\[HPG_DB.xlsx] & MachID & '!$A:$A,0),""not found"")"
As you can see, I was missing the double-quotes before and after the MachID variable. Arghhhhh!!!!!
Thank you again!