VBA code to find cells with a certain value with an if then statement after

BassettN

New Member
Joined
Apr 8, 2019
Messages
7
Good afternoon,

I am trying to find a certain cell value, and when it finds it, past a static value in the cell next to it. It is an error report, and there are 5 error columns, starting with "Reviewer Error 1 Comment" up to "Reviewer Error 5 Comment", and next to each of those there is currently a blank cell, but I want it to state "1) On Job Aid? 2) Automate? Best practice? Fix?"

I am new to VBA, but here is the code that is not working:

Code:
Sub ReviewerErrorAdd()


Dim SrchRng As Range
Dim cel As Range


Set SrchRng = ActiveSheet.Range("I1:I50")


For Each cel In SrchRng
    If cel.Value = "Reviewer Error *1 Comment" Then
        With cel.Offset(0, 1)
            .Value = "1) On Job Aid? 2) Automate? Best practice? Fix?"
            .Interior.Color = RGB(255, 255, 0)
            .Font.Color = vbBlack
        End With
    End If
Next cel


End Sub

Is what I am trying to accomplish not possible?

P.S., I've done many google searches, read many other questions, but none of them seem to really work for what I am trying to do.

Thank you in advance for reviewing this!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
In what way is it not working?
Do you only want to check I1:I50?
Is this line correct? :
Code:
If cel.Value = "Reviewer Error *1 Comment" Then
Should it be? :
Code:
If cel.Value = "Reviewer Error 1 Comment" Then
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top