adworldmedia
asked on
Excel VBA to Find Data and Insert specitic data in cell to the right
I have a piece of Excel VBA code that does a global search and replace for a variety of values.
Once this is done, I want to also have the macro insert a specific value in the column to the left of the found values... For instance, I have 100 rows with a value of "468x60", I want the macro to insert to the column on the left the value "CPM"... Then when it finds the next 100 rows of "Messenger" I want the macro to replace the value to the left with "Messenger Ad"....
Any help would be appreciated!!!
Once this is done, I want to also have the macro insert a specific value in the column to the left of the found values... For instance, I have 100 rows with a value of "468x60", I want the macro to insert to the column on the left the value "CPM"... Then when it finds the next 100 rows of "Messenger" I want the macro to replace the value to the left with "Messenger Ad"....
Any help would be appreciated!!!
Sub FixDimension()
Cells.Replace What:="Full Banner - 468 x 60", Replacement:="468x60", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Skyscraper - 120 x 600", Replacement:="120x600", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Medium Rectangle - 300 x 250", Replacement:="300x250", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Super Banner - 728 x 90", Replacement:="728x90", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="GEOPOP - 1 x 1", Replacement:="GeoPop", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="780x260 - 780 x 260", Replacement:="Bottom of Page", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Slider - 1 x 1", Replacement:="Messenger Ad", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Raw Click - 1 x 1", Replacement:="Raw Click", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Interstitial - 1 x 1", Replacement:="Interstitial", LookAt:=xlWhole, MatchCase:=False
Cells.Replace What:="Pixel/Popup - 1 x 1", Replacement:="Pop Under", LookAt:=xlWhole, MatchCase:=False
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.