Change the value in a column from Yes to No based on info from another column

zack8576

Active Member
Joined
Dec 27, 2021
Messages
271
Office Version
  1. 365
Platform
  1. Windows
I have a few thousand excel files that need to be modified, one of the modifications is changing the value from Yes to No in column E based on value from column D.
For example, if value in D is: F13345C, or F13355C, or F13365C, and if the value in E is Yes, this Yes will need to be changed to No
This is what I have so far, any help is appreciated

Edit: I found the issue, missing End If near the end, code is working fine now

VBA Code:
Sub ChangeYesToNo()
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    For i2 = 2 To LastRow
        If Range("D" & i2).Value Like "*F13345C*" Or _
           Range("D" & i2).Value Like "*F13355C*" Or _
           Range("D" & i2).Value Like "*F13365C*" Then
            Range("E" & i2).Value = "No" 'THIS IS WHERE THE BELL TOP SLABS CHANGED FROM NO TO YES
        End If
    Next i2
End Sub
 
Last edited:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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