Share via

Find & Replace Selected Rows?

Anonymous
2015-02-07T16:27:36+00:00

Hi there,

I currently use the code below to remove certain data from my sheet each week. It works perfectly, however starting soon, I will need to change the code so that it will Find & Replace on selected rows rather than the full sheet.

Findtext = Sheets("data").Range("C4").Value

Replacetext = Sheets("data").Range("A8").Value

Sheets("w3").Select

Cells.Replace What:=Findtext, Replacement:=Replacetext, LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

As you can see, this finds and replaces on the entire sheet. However, I now need it to be able to search certain cells, for example the first set would be to search cells A8 through A82 on sheet w3.

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

Answer accepted by question author

HansV 462.6K Reputation points
2015-02-07T16:41:22+00:00

Change

    Cells.Replace

to

    Range("A8:A82").Replace

if you want to select within range A8:A82, or to

    Selection.Replace

if you want to replace within the currently selected range.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2015-02-07T16:51:54+00:00

    Change

        Cells.Replace

    to

        Range("A8:A82").Replace

    if you want to select within range A8:A82, or to

        Selection.Replace

    if you want to replace within the currently selected range.

    Thank you!

    Was this answer helpful?

    0 comments No comments