Input text if cell with data does not equal

Livin404

Well-known Member
Joined
Jan 7, 2019
Messages
743
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Greetings, I've tried using the macro below, but it is adding text to everything. Anytime "ACV" is NOT entered in Column G, I need to have "THRU-LOAD" placed in the corresponding row in Column M. Thank you,

VBA Code:
Sub THRU_LOAD()
    Dim i As Long
    For i = 1 To ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
        Select Case Left(ActiveSheet.Cells(i, 3).Value, 3)
            Case Is <> "ACV"
                ActiveSheet.Range("N" & i) = "THRU-LOAD"
        End Select
    Next i
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Livin This should get the ball rolling. Now I guess there are some questions and let the questions begin. Like you say ACV is not entered in column G. Column G is 7 in the Cells( i, 7). You have an "N" in the code but you state column M in the instructions. So I have a program and data input and output below. Look it over and let us know what's next.

VBA Code:
Sub THRU_LOAD()
    Dim i As Long
    
    For i = 1 To ActiveSheet.Cells(Rows.Count, 7).End(xlUp).Row
    
        Select Case Left(ActiveSheet.Cells(i, 7).Value, 3)
        
            Case Is <> "ACV"
                ActiveSheet.Range("M" & i) = "THRU-LOAD"
        End Select
        
    Next i
End Sub

Book1
GHIJKLM
1MMACVTHRU-LOAD
2abcTHRU-LOAD
3ACVNN
4timeTHRU-LOAD
5ACV
Sheet1
 
Upvote 0
Solution
That is beautiful, and spot on! Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,454
Members
448,898
Latest member
drewmorgan128

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