LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default Find & replace

Try this (code untested).
Caution it will error out if the value of cel is not found on Sheet1

Dim cel As Range

For Each cel In Sheets("Sheet2").Columns(1)
If Len(cel) 0 Then
cel.Value = WorksheetFunction.Index(Sheets("Sheet1").Columns(2 ), _
Match(cel, Sheets("Sheet1"), 0), 1)
ElseIf Len(cel) = 0 Then
Exit Sub
End If
End Sub

You can build a safeguard
if worksheetfunction.Countif(Sheets("Sheet1").Columns (1),cel)0 then

end if


--
steveB

Remove "AYN" from email to respond
wrote in message
ups.com...
Here is my little problem:

1st spreadsheet
===============

Column A | Column B
---------+----------
AAA(Tab) | 80001
BBB(Tab) | 80002
CCC(Tab) | 80003
XXX(Tab) | 80004
YYY(Tab) | 80005
ZZZ(Tab) | 80006

2nd spreadsheet
===============

Column A
--------
AAA
AAA
AAA
AAA
BBB
BBB
BBB
BBB
CCC
CCC
YYY
YYY
ZZZ
ZZZ
ZZZ
XXX
XXX

Expected result:
----------------

2nd spreadsheet
===============

Column A
--------
80001
80001
80001
80001
80002
80002
80002
80002
80003
80003
80005
80005
80006
80006
80006
80004
80004

I need to translate column A in the 2nd spreadsheet to numbers from the
1st spreadsheet (column B). I would appreciate any suggestion.

Regards,
koobel



 
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
Find & Replace: find part cell, replace whole cell katy Excel Worksheet Functions 3 April 3rd 23 01:20 PM
Find and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find and replace results can the appearance of find be different? LLS at DPW Excel Discussion (Misc queries) 2 October 26th 09 11:16 PM
where to put results of find operation in find and replace functio DEP Excel Worksheet Functions 5 November 15th 06 07:52 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM


All times are GMT +1. The time now is 10:19 PM.

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

About Us

"It's about Microsoft Excel"