Dear
I have made a search box through a command button to search for textboxes.
It changes also the font immediatly so that you fast notices where it is.
But because i have made a lot of textboxes and different fonts I need to only change the back color.
Ho does the code needs to be adjusted in the first code so that the background changes to orange background of the textbox?
How can i reset the background to white in the next command button
Private Sub CommandButton2_Click()
I have made a search box through a command button to search for textboxes.
It changes also the font immediatly so that you fast notices where it is.
But because i have made a lot of textboxes and different fonts I need to only change the back color.
Ho does the code needs to be adjusted in the first code so that the background changes to orange background of the textbox?
Code:
Private Sub CommandButton1_Click()
Dim FindWhat As String, tb As TextBox
On Error Resume Next
FindWhat = InputBox("Find what?")
If FindWhat = "" Then Exit Sub
For Each tb In ActiveSheet.TextBoxes
l = InStr(tb.Characters.Text, FindWhat)
If l > 0 Then
With tb.Characters(Start:=l, Length:=Len(FindWhat)).Font
.ColorIndex = 3
.Bold = True
End With
End If
Next
End Sub
How can i reset the background to white in the next command button
Code:
Private Sub CommandButton2_Click()
Dim FindWhat As String
On Error Resume Next
For Each tb In ActiveSheet.TextBoxes
With tb.Characters.Font
.ColorIndex = 0
.Bold = False
End With
Next