A
Alen32
I have this macro which searching for 3 words in same row and if it find
some then display them in listbox. some rows contain hyperlink and i would
like to keep this function. please help.
some er hyperlinks on internet and some on my c:drive.
Private Sub CommandButton1_Click()
Dim sOne, sOneItem
With UserForm1
'******
If .OptionButton1 Then sOne = Array("Horse")
If .OptionButton2 Then sOne = Array("Pig")
If .OptionButton5 Then sOne = Array("Horse", "Pig")
'******
If .OptionButton3 Then
sTwo = "Dansk"
Else
sTwo = "Engelsk"
End If
sThree = .TextBox1.Text
End With
'******
For Each sOneItem In sOne
'******
'MsgBox sOneItem
With Worksheets(1).Cells
Set c = .Find(sOneItem, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If Application.CountIf(c.EntireRow, "*" & sTwo & "*") And _
Application.CountIf(c.EntireRow, "*" & sThree & "*")
Then
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 0) _
= c.Offset(0, -6).Value
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 1) _
= c.Offset(0, -3).Value
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
'******
Next
'******
End Sub
some then display them in listbox. some rows contain hyperlink and i would
like to keep this function. please help.
some er hyperlinks on internet and some on my c:drive.
Private Sub CommandButton1_Click()
Dim sOne, sOneItem
With UserForm1
'******
If .OptionButton1 Then sOne = Array("Horse")
If .OptionButton2 Then sOne = Array("Pig")
If .OptionButton5 Then sOne = Array("Horse", "Pig")
'******
If .OptionButton3 Then
sTwo = "Dansk"
Else
sTwo = "Engelsk"
End If
sThree = .TextBox1.Text
End With
'******
For Each sOneItem In sOne
'******
'MsgBox sOneItem
With Worksheets(1).Cells
Set c = .Find(sOneItem, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If Application.CountIf(c.EntireRow, "*" & sTwo & "*") And _
Application.CountIf(c.EntireRow, "*" & sThree & "*")
Then
UserForm1.ListBox1.AddItem
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 0) _
= c.Offset(0, -6).Value
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 1) _
= c.Offset(0, -3).Value
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
'******
Next
'******
End Sub