VBA to Change Value of Cell Based on Text in Another Row

FrenchCelt

Board Regular
Joined
May 22, 2018
Messages
210
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm trying to code a macro to look for the text 4STOP in Row 4. If so, then the value of the cell in Row 15 in the same column needs to change to the value in Row 47. Then it needs to loop through every column in the dataset (dynamic range). I was looking at some code some others have helped me out with that does similar things (look for the same basic text and then execute an action), but I couldn't figure out a way to adapt from either.

Any help would be greatly appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
VBA Code:
Sub Change_Value()
For c = 1 To Cells(4, Columns.Count).End(xlToLeft).Column
If Cells(4, c) = "4STOP" Then Cells(15, c) = Cells(47, c)
Next c
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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