cisterne
01-17-2019, 03:57 AM
I am trying to get the row number, where the criteria meets a certain value
I have been trying with this 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
I have been trying with this 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