Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings, I am trying to insert text (Column E) in a cell if there is a number in another cell Column E. The problem is even for the blank cells "TBD" is being inserted in Column D. Now I'm trying to clear the contents of Column D, so excel doesn't think there is data there. I would need to except for this code to ignore one is the word "ROLL CALL" and another is any four digit number "####". Column D is in a Text format.
VBA Code:
Sub DoNotContainrollcall()
Dim rng As Range
Dim cell As Range
Dim ContainWord As String
With Sheets("72 HR")
With .Range("D2", .Range("D" & Rows.Count).End(xlUp))
ContainWord = "ROLL CALL". "####"
For Each cell In rng.Cells
If cell.Find(ContainWord) Is Nothing Then cell.Clear
Next cell
End With
End With
End Sub