Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Multiple Criteria Find & Replace

Wondering if there is a script out there that can find and replace
multiple cells with different criteria.

Example:

Worksheet tab 1:
Columns
A B
Red 1
Green 2
Blue 3


Worksheet tab 2:
Columns
A B C
1 1 3
2 1 2
2 3 1

After macro/script, we would have replaced the numbers in Worksheet
tab 2 with the words from Worksheet tab 1, so Worksheet tab 2 would
look like this:

Worksheet tab 2:
Columns
A B C
Red Red Blue
Green Red Green
Green Blue Red


Thanks for any help!

Al
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 747
Default Multiple Criteria Find & Replace

Sub findreplace()

Dim cell As Range

For Each cell In Sheets("sheet2").UsedRange
cell.Replace What:="1", Replacement:="Red"
cell.Replace What:="2", Replacement:="Green"
cell.Replace What:="3", Replacement:="Blue"
Next

End Sub


On Oct 20, 7:30*pm, Alfred wrote:
Wondering if there is a script out there that can find and replace
multiple cells with different criteria.

Example:

Worksheet tab 1:
Columns
A * * * * B
Red * * 1
Green * 2
Blue * * 3

Worksheet tab 2:
Columns
A * B * C
1 * 1 * *3
2 * 1 * 2
2 * 3 * 1

After macro/script, we would have replaced the numbers in Worksheet
tab 2 with the words from Worksheet tab 1, so Worksheet tab 2 would
look like this:

Worksheet tab 2:
Columns
A * * * *B * * * *C
Red * * Red * Blue
Green *Red * Green
Green *Blue *Red

Thanks for any help!

Al


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Multiple Criteria Find & Replace

Thanks!


On Oct 20, 11:05*am, muddan madhu wrote:
Sub findreplace()

Dim cell As Range

For Each cell In Sheets("sheet2").UsedRange
* cell.Replace What:="1", Replacement:="Red"
* cell.Replace What:="2", Replacement:="Green"
* cell.Replace What:="3", Replacement:="Blue"
Next

End Sub

On Oct 20, 7:30*pm, Alfred wrote:

Wondering if there is a script out there that can find and replace
multiple cells with different criteria.


Example:


Worksheet tab 1:
Columns
A * * * * B
Red * * 1
Green * 2
Blue * * 3


Worksheet tab 2:
Columns
A * B * C
1 * 1 * *3
2 * 1 * 2
2 * 3 * 1


After macro/script, we would have replaced the numbers in Worksheet
tab 2 with the words from Worksheet tab 1, so Worksheet tab 2 would
look like this:


Worksheet tab 2:
Columns
A * * * *B * * * *C
Red * * Red * Blue
Green *Red * Green
Green *Blue *Red


Thanks for any help!


Al


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 897
Default Multiple Criteria Find & Replace

You don't need to loop, you can use the Replace function directly on
the entire range.

Sub findreplace()

With Sheets("Sheet2").UsedRange
.Replace What:="1", Replacement:="Red"
.Replace What:="2", Replacement:="Green"
.Replace What:="3", Replacement:="Blue"
End With

End Sub

On Oct 20, 11:05*am, muddan madhu wrote:
Sub findreplace()

Dim cell As Range

For Each cell In Sheets("sheet2").UsedRange
* cell.Replace What:="1", Replacement:="Red"
* cell.Replace What:="2", Replacement:="Green"
* cell.Replace What:="3", Replacement:="Blue"
Next

End Sub

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
multiple find and replace Andre Excel Worksheet Functions 1 May 26th 09 02:31 PM
Customized Find/Replace to Update Numbers Using Specified Criteria Cube Slave Excel Discussion (Misc queries) 4 August 17th 07 04:40 PM
Multiple find mulitple replace spaceage Excel Worksheet Functions 1 March 29th 07 11:42 AM
Find/Replace in multiple worksheets Lynn Excel Discussion (Misc queries) 1 March 22nd 07 04:17 PM
Multiple Find and Replace in one function [email protected] Excel Worksheet Functions 4 September 11th 06 03:16 AM


All times are GMT +1. The time now is 12:03 AM.

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"