loop replacing certain text in multiple columns

daveyc18

Active Member
Joined
Feb 11, 2013
Messages
454
Office Version
  1. 365
  2. 2010
Code:
For Count = Range("a" & Rows.Count).End(xlUp).Row To 1 Step -1


If Range("a" & Count) = "STIM" And Range("b" & Count) = "U$" And Range("c" & Count) = "053" Then 

Range("a" & Count).Value = "STIH" And Range("b" & Count).Value = "U$" And Range("c" & Count).Value = "981"


Next

think it said type mismatch...clearly the code is wrong and im lookign for a solution pls
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,486
Office Version
  1. 365
Platform
  1. Windows
You can check for multiple conditions in one line, but when setting multiple values, they must be on different lines (and you need an End If), i.e.
Code:
For Count = Range("a" & Rows.Count).End(xlUp).Row To 1 Step -1

    If Range("a" & Count) = "STIM" And Range("b" & Count) = "U$" And Range("c" & Count) = "053" Then 
        Range("a" & Count).Value = "STIH" 
        Range("b" & Count).Value = "U$" 
        Range("c" & Count).Value = "981"
    End If

Next
 

Watch MrExcel Video

Forum statistics

Threads
1,109,331
Messages
5,528,052
Members
409,800
Latest member
camronmartin

This Week's Hot Topics

Top