anish.ms
12-08-2020, 11:20 AM
Hi,
Request help in below code which highlights the search values if in Upper, Lower or Proper case. How do I highlight the search text irrespective of it's case. For example the below code will not highlight cells with value "VBA Express" if I input "vba express" and search Thanks in advance for the help!
Option Explicit
Sub HighlightSearchValues()
Dim Rng As Range
Dim i As Integer
Dim c As Variant
c = InputBox("Enter Value To Highlight")
For Each Rng In ActiveSheet.UsedRange
'If Rng = c Then
If Rng = c Or Rng = UCase(c) Or Rng = LCase(c) Or Rng = WorksheetFunction.Proper(c) Then
Rng.Style = "Note"
i = i + 1
End If
Next Rng
MsgBox "There are total " & i & " " & c & " in this worksheet."
End Sub
Request help in below code which highlights the search values if in Upper, Lower or Proper case. How do I highlight the search text irrespective of it's case. For example the below code will not highlight cells with value "VBA Express" if I input "vba express" and search Thanks in advance for the help!
Option Explicit
Sub HighlightSearchValues()
Dim Rng As Range
Dim i As Integer
Dim c As Variant
c = InputBox("Enter Value To Highlight")
For Each Rng In ActiveSheet.UsedRange
'If Rng = c Then
If Rng = c Or Rng = UCase(c) Or Rng = LCase(c) Or Rng = WorksheetFunction.Proper(c) Then
Rng.Style = "Note"
i = i + 1
End If
Next Rng
MsgBox "There are total " & i & " " & c & " in this worksheet."
End Sub