find/replace macro

jimmjam

New Member
Joined
Jun 17, 2011
Messages
1
Hello. I'm trying to build a macro that will find and replace contents. here is my code...
Range("B87").Select
Selection.Copy
Sheets("PCD LINK").Select
Cells.Replace What:="PCD MODEL NAME", Replacement:= _
"Acosta, Inc._Traditional_Model_T4362_O1_BErd_20110214_0830PM.xlsm", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Sheets("PCD").Select
End Sub

The problem is, that the macro wants to keep replacing the text with the name of the cell that originally wrote the macro and not the contents thereafter. Know what I mean?

I.e. When I wrote the macro I used a test file, but on a go forward basis , I want it to replace the found words with a new name each time it's used, and not the name that originally wrote the macro.


PLEASE HELP!!!


Thanks

JIM
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
First off, it's very rare that you need to Select anything in VBA. You can work with ranges directly.

You have to remember we have no idea what you are trying to accomplish, so please explain it to us again with the understanding that we no nothing of your project.

Perhaps you could post some sample data and expected results.

Also, why are you copying a range that you never paste anywhere?
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

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
Back
Top