Find rækkenummer i lukket regneark
Jeg prøver på at finde rækkenummeret i et andet regenark, hvor værdien af cellen er lige med et bestemt ordHar rodet lidt rundt med denne kode:
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