[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Public Sub ChngDiffs()
Dim intRows As Integer
Dim i As Integer
Dim rng As Range
Set rng = ActiveSheet.UsedRange
intRows = rng.Rows.Count
i = 1
Do While i <= intRows
If Cells(i, 9) = 9 And Cells(i, 2) = "DIFFS" Then Cells(i, 9) = "X"
i = i + 1
Set rng = Nothing
Open in new window
Dim lr As Long
Dim found As Boolean
Application.ScreenUpdating = False
lr = Cells(Rows.Count, "I").End(xlUp).Row
With Rows(1) 'Assuming the header row is row1
.AutoFilter field:=2, Criteria1:="DIFFS"
.AutoFilter field:=9, Criteria1:=9
If Range("I1:I" & lr).SpecialCells(xlCellTypeVisible).Cells.Count > 1 Then
found = True
Range("I2:I" & lr).SpecialCells(xlCellTypeVisible).Value = "X"
If found Then
MsgBox "All the 9's have been changed to ""X"" where column B had ""DIFFS"".", vbInformation, "Done"
MsgBox "No such cells were found in column I.", vbExclamation, "No Cells Found!"
Application.ScreenUpdating = True
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.