Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 12th, 2007, 06:31 AM
Authorized User
 
Join Date: Apr 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Match the names against standard name range

I have two columns. One column is having standard names (suppose product names), in second column i have the same names but in capital/ or some other format( maybe that some letters are capital & some are small).

Now i want to match the names in column2 against the standard names in column 1 & replace by the standard names.

Please suggest....

Yogesh
__________________
Yogesh
 
Old May 14th, 2007, 12:00 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Here is a simpe replacement way:

Sub Replace_TExt()


  For i = 1 To ActiveSheet.Range("B:B").Cells.SpecialCells(xlCell TypeLastCell).Row

    If Trim(ActiveSheet.Range("B" & i)) <> "" Then

        ActiveSheet.Range("A:A").Replace What:=ActiveSheet.Range("B" & i), Replacement:=ActiveSheet.Range("B" & i).Value, _
        LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:= _
        False, ReplaceFormat:=False

    End If

  Next i
End Sub

Cheers
Shasur

http://www.vbadud.blogspot.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard or Professional Edition?? James_E BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 28th, 2007 04:45 AM
template match doesnt match the required node Tomi XSLT 2 March 12th, 2007 06:24 AM
Download C++ standard ironchef Visual C++ 2005 0 September 15th, 2006 04:51 PM
Horton's Into to MSVC++ 6.0 Standard Norman Visual C++ 1 July 22nd, 2004 07:45 PM
Standard -> Enterprise Greg Griffiths SQL Server 2000 4 January 12th, 2004 12:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.