I have a database with 2 columns like: (example)
<code>AA 6
VE 9
HE 18
AO 12
PF 7
The code to search the rows I want, and to clean the search is already done:
<code>Sub B2_Click()
Dim c As String
Dim l As Integer
c = "B"
l = 2
Do While Not IsEmpty(Range(c & l))
If Range(c & l) > Range("G2") Then
Range("B" & l).Interior.ColorIndex = 30
Range("A" & l).Interior.ColorIndex = 36
Range("B" & l).Font.ColorIndex = 2
End If
l = l + 1
Loop
If IsEmpty(Range("G2")) Then
Range("G1") = "Please insert value:"
Range("G1").Font.Bold = 1
Range("G1").Font.ColorIndex = 30
End If
End Sub
Sub B3_Click()
Dim c As String
Dim l As Integer
c = "B"
l = 2
Do While Not IsEmpty(Range(c & l))
Range("A" & l).Interior.ColorIndex = 0
Range("B" & l).Interior.ColorIndex = 0
Range("B" & l).Font.ColorIndex = 1
l = l + 1
Loop
Range("G2") = ""
Range("G1") = ""
End Sub
but i need to add two option buttons so I can choose if I want to search
for values > or < than the value on Range("G2"). Can someone
please help me how to write the search?</code></code>
<code>AA 6
VE 9
HE 18
AO 12
PF 7
The code to search the rows I want, and to clean the search is already done:
<code>Sub B2_Click()
Dim c As String
Dim l As Integer
c = "B"
l = 2
Do While Not IsEmpty(Range(c & l))
If Range(c & l) > Range("G2") Then
Range("B" & l).Interior.ColorIndex = 30
Range("A" & l).Interior.ColorIndex = 36
Range("B" & l).Font.ColorIndex = 2
End If
l = l + 1
Loop
If IsEmpty(Range("G2")) Then
Range("G1") = "Please insert value:"
Range("G1").Font.Bold = 1
Range("G1").Font.ColorIndex = 30
End If
End Sub
Sub B3_Click()
Dim c As String
Dim l As Integer
c = "B"
l = 2
Do While Not IsEmpty(Range(c & l))
Range("A" & l).Interior.ColorIndex = 0
Range("B" & l).Interior.ColorIndex = 0
Range("B" & l).Font.ColorIndex = 1
l = l + 1
Loop
Range("G2") = ""
Range("G1") = ""
End Sub
but i need to add two option buttons so I can choose if I want to search
for values > or < than the value on Range("G2"). Can someone
please help me how to write the search?</code></code>