Sub findhighlightstring()
' VBA color cells that contains the value (Ignoring Case Sensitivity)
Dim rng As Range
Dim cell As Range
Dim serchstring As String
Set rng = ActiveSheet.UsedRange
searchstring = InputBox("Enter the search string", "Search")
On Error Resume Next
For Each cell In rng
If UCase(cell.Value) Like "*" & UCase(searchstring) & "*" Then
cell.Font.Bold = True
cell.Interior.Color = vbYellow
End If
Next cell
End Sub
' VBA color cells that contains the value (Ignoring Case Sensitivity)
Dim rng As Range
Dim cell As Range
Dim serchstring As String
Set rng = ActiveSheet.UsedRange
searchstring = InputBox("Enter the search string", "Search")
On Error Resume Next
For Each cell In rng
If UCase(cell.Value) Like "*" & UCase(searchstring) & "*" Then
cell.Font.Bold = True
cell.Interior.Color = vbYellow
End If
Next cell
End Sub
No comments:
Post a Comment