+ Reply to Thread
Results 1 to 12 of 12

Find and Replace All With Excel VBA- in a range

  1. #1
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Find and Replace All With Excel VBA- in a range

    Hi all ,

    Good day !!

    I have requirement where my date needs replace set of list against set of another list example listed below

    006=005
    032=030
    034=030
    047=040
    C41=C01


    however , I tried a formula but that gave me in entire active sheet , I need that only in particular range .
    Please Login or Register  to view this content.
    Could some one help me please .



    regrads,

    Hudson

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find and Replace All With Excel VBA- in a range

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    Hi john,

    above given formula fetch could replace in entire sheet , which I don't want that way... I need it in particular range or column (Example : I want that values to be replaced only in column B or C ).

    can you advice please.?.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find and Replace All With Excel VBA- in a range

    It should replace only the C1 value ie - sht.Range("C:1"), can you attach a sample where it's replace every cell in the sheet?

  5. #5
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    John - thanks again !!!

    here is the data . kindly advice please
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    John- can you please ensure also when we replace it with desire values it should replace in text format or text values .


    Appreciate your assistance .

    Hudson

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find and Replace All With Excel VBA- in a range

    Based on your sample what would you want too happen? I'm unclear on that.

  8. #8
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    John - in column C values should change with find and replace ..

    for example :
    in column C any value with 006 should change to 005
    and 032 with 030 so on like below


    006=005
    032=030
    034=030
    047=040
    C41=C01

    column B and C or one and the same anything is ok for me ..

  9. #9
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    could some one please advice me , on my request please !!!

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,970

    Re: Find and Replace All With Excel VBA- in a range

    Quote Originally Posted by JOHN H. DAVIS View Post
    It should replace only the C1 value ie - sht.Range("C:1")
    That will produce a runtime error. Did you mean sht.Range("C:C")? Or sht.Range("C1")?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  11. #11
    Forum Contributor
    Join Date
    05-04-2016
    Location
    London
    MS-Off Ver
    MS Office Excel 2010/2013
    Posts
    354

    Re: Find and Replace All With Excel VBA- in a range

    i am not clear of what your are saying ... however i have tried by changing both .... ( C:C) and ( C1) .

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,970

    Re: Find and Replace All With Excel VBA- in a range

    The argument to Range can be a string that gives a range in the same syntax used in a worksheet formula. "C:1" is not a valid range. The colon is used to specify a contiguous rectangular range from an upper-left cell to a lower-right cell. So "C1:D2" is a range with 4 cells, and "C:E" is a range that specifies the entire columns for C, D, and E. But "C:1" doesn't mean anything and that line of code will generate an error when it executes.

    From the context of what you are doing I think "C:C" is correct. But it sounds like the code still isn't doing what you want. Your post #8 is clear and basically says the same thing you started with. How is the code different than that?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] find and replace range vs list
    By 13lack13lade in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-16-2015, 02:02 AM
  2. Replies: 3
    Last Post: 11-25-2014, 06:08 AM
  3. Find and Replace values in a selected Range
    By jskasango in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2014, 09:11 AM
  4. [SOLVED] How to Find and Replace a Range of Data
    By Chad Bateman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-13-2014, 12:47 AM
  5. find in excel replace in word: find/replace text in text boxes and headers
    By dean.rogers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2012, 12:40 PM
  6. Find and Replace Values in Range
    By ThatGirlinMS in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2006, 12:45 PM
  7. Find/replace range
    By Corrine in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-26-2006, 09:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1