Hi all,
I've got a piece of code I'm stuck on. Basically, I have a range of data and most cells are empty. However, I want to replace all the nonblank cells with an X. I can't quite figure out how to have the code replace something non-specific...
Here's what I've got - right now, it can find nonblanks, and color them red
Sub test()
Dim Rng As Range, Cl As Range
Set Rng = Range("e4:o17")
For Each Cl In Rng
If Cl <> "" Then
With Cl.Font
.Strikethrough = True
.ColorIndex = 3
End With
End If
Next Cl
End Sub
Here's the one that has a piece of the replace code, that doesn't work:
Sub test2()
Dim Rng As Range, Cl As Range
Set Rng = Range("e4:o17")
For Each Cl In Rng
If Cl <> "" Then
C1.Replace What:=C1, Replacement:="X", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
End If
Next Cl
End Sub
Basically, how do I get the code to just place whatever the number is with an X? I'd appreciate any help - thanks!
Bookmarks