Find and Replace

Wuddle

New Member
Joined
Oct 29, 2002
Messages
22
I have an imported document each month that needs one of the fields changed into various abbreviations. The abbreviations remain the same and there will be no variations.
How can I create a macro to find and replace the exact same text each time and not come up with the requirement to keep presssing the OK button.
Thanks in advance
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
On 2003-02-05 04:26, Wuddle wrote:
I have an imported document each month that needs one of the fields changed into various abbreviations. The abbreviations remain the same and there will be no variations.
How can I create a macro to find and replace the exact same text each time and not come up with the requirement to keep presssing the OK button.
Thanks in advance

Hi Wuddle. I suggest you create an update query to amend the records in the table. How many abbreviations do you have? Perhaps give a couple examples.

With an update query you can, for example, use an IIF expression to say if value = United States then abbreviate to USA. IIf can only handle limited (max 7 I think) variations though so if you have loads of abbreviations then this may not be the best way and using Code may be required.

Also with a macro things need to be in consistent locations so are you importing into the same table each time or a new table? I would recommend importing to the same table and using an import specification so that you can automate this as well presuming the data you are importing is always the same type.
 
Upvote 0
You could also make a table of the value and its abbreviation. For example,

About @
Because b/c
Within w/in

So say you wanted to change the values in the first column to the ones in the second each month. Make a table of your changes (one column is the value you want to change, the second column is the value you want to change TO), then create a Make-Table query in which you link your monthly table to the "abbreviation" table (by the field you want to change). Then Select all fields from the monthly table except the one you want to change, and select the abbreviation field from the "abbreviation" table, and make your new table.

HTH,

Russell
 
Upvote 0

Forum statistics

Threads
1,221,507
Messages
6,160,219
Members
451,631
Latest member
coffiajoseph

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