Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default can I save a file of multiple names to replace using excell 03

I have a list of approx 300 names that must be replaced with abbreviations in
excell. I must do this every few days. Is there a way to save the multiple
replacement values into a command so I can replace the same list in a single
step?

Thank You
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default can I save a file of multiple names to replace using excell 03

I'd create another worksheet.

Column A would hold the old words
column B would hold the abbreviations

Then have a macro that would loop through those cells to do mass changes.

Something like:

Option Explicit
Sub testme()

Dim ListWks As Worksheet
Dim WksToFix As Worksheet
Dim myCell As Range
Dim myRng As Range

Set ListWks = ThisWorkbook.Worksheets("sheet1")
Set WksToFix = ActiveSheet

With ListWks
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
WksToFix.Cells.Replace what:=myCell.Value, _
replacement:=myCell.Offset(0, 1).Value, _
searchorder:=xlByRows, MatchCase:=xlNo, _
lookat:=xlWhole
Next myCell
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Greg is working hard. wrote:

I have a list of approx 300 names that must be replaced with abbreviations in
excell. I must do this every few days. Is there a way to save the multiple
replacement values into a command so I can replace the same list in a single
step?

Thank You


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default can I save a file of multiple names to replace using excell 03

You could even put that worksheet with the list in another workbook. Just put
the macro in that workbook, too.

Then open that workbook when you need to do the work.

Open your workbook to fix.
Activated the sheet to fix.

Alt-f8 to see the list of macros and run TestMe. (Rename that to something
better, though.)

Dave Peterson wrote:

I'd create another worksheet.

Column A would hold the old words
column B would hold the abbreviations

Then have a macro that would loop through those cells to do mass changes.

Something like:

Option Explicit
Sub testme()

Dim ListWks As Worksheet
Dim WksToFix As Worksheet
Dim myCell As Range
Dim myRng As Range

Set ListWks = ThisWorkbook.Worksheets("sheet1")
Set WksToFix = ActiveSheet

With ListWks
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
WksToFix.Cells.Replace what:=myCell.Value, _
replacement:=myCell.Offset(0, 1).Value, _
searchorder:=xlByRows, MatchCase:=xlNo, _
lookat:=xlWhole
Next myCell
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Greg is working hard. wrote:

I have a list of approx 300 names that must be replaced with abbreviations in
excell. I must do this every few days. Is there a way to save the multiple
replacement values into a command so I can replace the same list in a single
step?

Thank You


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a comma separated text file and save it. BristolBreeze Excel Discussion (Misc queries) 0 March 23rd 06 10:32 AM
save to same file as opened dmtech Excel Discussion (Misc queries) 6 March 8th 06 06:25 PM
changing file names saybut Excel Discussion (Misc queries) 2 February 20th 06 03:49 PM
save excel file from a table delimited file (.txt) using macros sedamfo New Users to Excel 1 February 15th 05 04:19 AM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM


All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"