Find in row
On 6 ruj, 10:16, Brian wrote:
Hello all,
I am having difficulties trying to find the combobox value across Row A then
goto the first empty cell in that column. Can't get past the first hurdle.
Private Sub ComboBox6_Change()
Dim myvalue As String
myvalue = ComboBox6.Value
Range("A").Select
Range("A").Value = Rows("A" & TheRow).find(What:="myvalue", LookAt:=xlWhole)
If found = True Then
Cell.Select
End If
End Sub
hello Brian,
1. You must have Do loop or For loop or something wath will be a
counter for your "TheRow" variable.
2. If you see a 2. row then you will see the error. You write
"Range("A").Select" and my question is: Were is the number of row or
variable for the number of row?
3. It is not "LookAt:=xlWhole" it is "LookAt:=xlPart"! Why? Because
constant xlWhole look on whole cell, and xlPart look inside of cell
and take a look for your word or something else
4. My suggestion is :
Dim myvalue As
String
With
Worksheets(1).Range("a1:a36")
Set finder = .Find("dobar", Lookat:=xlPart)
If Not finder Is Nothing Then
firstAddress = finder.Address
Do
finder.Interior.ColorIndex = 3
Set finder = .FindNext(finder)
Loop While Not finder Is Nothing And finder.Address < firstAddress
End If
End With
By ,I.R;)
|