Find Text in One Row and Replace With Text Based on Value in Another Row

FrenchCelt

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

I searched around for solutions first, but none quite fit the situation I have here. I'm trying to find and replace all text in Row 3 that says "Nose" with either "4STOP" or "3STOP", but it depends on the value in Row 10 of the same column. If it says 4, then replace with 4STOP, if 3 then 3STOP.

Any help would be appreciated.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
try
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("a3") = "Nose" Then
    ActiveSheet.Range("a3") = ActiveSheet.Range("a10") & "stop"
End If
End Sub
under worksheet object in vba...

HTH
 
Upvote 0
How about
VBA Code:
Sub FrenchCelt()
   With Range("A3", Cells(3, Columns.Count).End(xlToLeft))
      .Value = Evaluate(Replace("if(@="""","""",if(@=""nose""," & .Offset(7).Address & "&""STOP"",@))", "@", .Address))
   End With
End Sub
 
Upvote 0
Solution
try
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("a3") = "Nose" Then
    ActiveSheet.Range("a3") = ActiveSheet.Range("a10") & "stop"
End If
End Sub
under worksheet object in vba...

HTH
This does nothing even resembling what's asked in the OP, and asking for it to be placed in Worksheet_SelectionChange borders on harmful advice.
 
Upvote 0
Thanks Fluff. I did have to change your A3 to B3, as Column A contains labeling info for each of the rows (the data is basically in table form). Once I did that, everything worked out perfectly.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

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