Share via

Replace value cell with another value in VBA

Anonymous
2018-03-08T23:22:34+00:00

Hello, i need few help in an excel function that i used to replace text in a cell with another one and this is the function it work perfect and this is the function :

rngTargetD.Replace _

 What:="HELLO", Replacement:="HI", _

 SearchOrder:=xlByColumns, MatchCase:=True

My questions is , how can i change this function if in case the value that i want to change is an array ?

Thank you so much

Moved from: Office / Excel / Windows 10 / Office 2013

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2018-03-09T14:26:44+00:00

    Hi Hassan,

    Select the range of cell and then run this macro:

    Sub ReplaceSelection() <br><br>    <br><br> Selection.Replace _ <br><br> What:="HELLO", Replacement:="HI", _ <br><br> SearchOrder:=xlByColumns, MatchCase:=True <br><br>  <br><br>End Sub

    It's applied to all selected cell.

    Hope that helps.

    Was this answer helpful?

    0 comments No comments