Range Replace List in Column

Eyes0ftheworld

New Member
Joined
Apr 23, 2014
Messages
28
Hi!

I have a macro that defines a range from a list and then searches and removes certain terms. It was working before, but now it seems to not work. The entire macro jumps back and forth between two workbooks.

Code:
Dim ParentBk As String
ParentBk = ActiveWorkbook.Name
Dim rng As Range
Dim cell As Range
Dim sht As Worksheet
Set sht = Workbooks(ParentBk).Worksheets("Directions")
Set rng = sht.Range(sht.Cells(100, 2), sht.Cells(Rows.Count, 2).End(xlUp))
rng.Replace _
What:=" Impressions", Replacement:="", _
SearchOrder:=xlByColumns
rng.Replace _
What:="Total", Replacement:="", _
SearchOrder:=xlByRows
rng.Replace _
What:="Campaign Name", Replacement:="", _
SearchOrder:=xlByRows
rng.Replace _
What:="Date", Replacement:="", _
SearchOrder:=xlByRows
rng.Replace _
What:="Media Partner Name", Replacement:="", _
SearchOrder:=xlByRows
rng.Replace _
What:="Placement Name", Replacement:="", _
SearchOrder:=xlByRows

rng.Sort Key1:=Range("B100"), order1:=xlAscending, Header:=xlNo
Set rng = sht.Range(sht.Cells(100, 2), sht.Cells(Rows.Count, 2).End(xlUp))
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,190,918
Messages
5,983,578
Members
439,852
Latest member
balasat

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
Top