-
Solved: Using find function
Hi!
I am trying to write code which has to find string combination " Rh" in a cell. Cells are in cycle so the whole coloumn will be searched.
Somehow I get an error message - Object required, but I have refferred to worksheet ... Can someone help me please
[VBA]Sub otsib rh()
Dim i As Integer
Dim otsi As String
Dim rida As String
i = 0
Do While i < 100
i = i + 1
rida = " Rh"
Set otsi = Worksheets(1).Cells(i, 2).Find(rida, MatchCase:=False)
' just for checking if the code works
`If Not otsi Is Nothing Then
Cells(i, 10).Value = 10
Loop
End Sub[/VBA]
Many thanks ahead
Last edited by Aussiebear; 05-03-2012 at 11:00 PM.
Reason: Added the correct tags to the supplied code
-
[vba]Sub otsibrh()
Dim i As Integer
Dim otsi As Range
Dim rida As String
i = 0
Do While i < 100
i = i + 1
rida = " Rh"
Set otsi = Worksheets(1).Cells(i, 2).Find(rida, MatchCase:=False)
' just for checking if the code works
If Not otsi Is Nothing Then
Cells(i, 10).Value = 10
End If
Loop
End Sub
[/vba]
-
Preciate very much!
I changed worksheet to activsheet works better
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules