Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Find & Replace Selected Rows? Hi there, I currently use the code below to remove

ID: 640713 • Letter: F

Question

Find & Replace Selected Rows?

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.

Thanks !!

Explanation / Answer

Hi..

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..

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote