Input text if cell with data does not equal

Livin404

Active Member
Joined
Jan 7, 2019
Messages
460
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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Ezguy4u

Board Regular
Joined
Feb 10, 2010
Messages
154
Office Version
  1. 2019
Platform
  1. Windows
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
 
Solution

Livin404

Active Member
Joined
Jan 7, 2019
Messages
460
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
That is beautiful, and spot on! Thank you!
 

Ezguy4u

Board Regular
Joined
Feb 10, 2010
Messages
154
Office Version
  1. 2019
Platform
  1. Windows
Thank you for the feed back and just glad I could help
 

Livin404

Active Member
Joined
Jan 7, 2019
Messages
460
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Thank you for the feed back and just glad I could help
Thank you for thanking me, I just posted another questions, indirectly related to our resolved issue.
 

Forum statistics

Threads
1,141,715
Messages
5,708,049
Members
421,540
Latest member
quocbinh

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
Top