ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find row (and column) (https://www.excelbanter.com/excel-programming/291281-re-find-row-column.html)

Tom Ogilvy

Find row (and column)
 
Dim d as range
For n = 1 To i
With Range("B4:b369")
Set d = .Find(What:=dato(n), _
Lookin:=xlValues, Lookat:=xlPart, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not d Is Nothing Then
rad = d.Row
End If
End With
Next

Try doing the search manually and see if it is found. If you are looking
for a date, Find sometimes has a hard time with dates. Adjust the arguments
above to Find to match where and how find should look for the value.
Searching a single row would be no different.

--
Regards,
Tom Ogilvy


"Jon B" wrote in message
...
I am a newbie and need some help. I am trying to find the row and thats

match the value in Dato(n), but the code below does not work. It cannot find
the value that it is looking for. What can I have done wrong here.

My main purpose is really to find the row that match, but in addition I

would do the same for columns (With different values), so that I get the row
and column that match to criteria I have, so I will get the intersection
between the two. Maybe it is an easier way to find this.


For n = 1 To i
With Range("B4:b369")
Set d = .Find(dato(n))
If Not d Is Nothing Then
rad = d.Row
End If
End With
Next

I have "dimmed" d as Variant, and I know that this is not correct, what

kind of declaration should the d have.

Regards,

Jon





All times are GMT +1. The time now is 05:38 PM.

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