+ Reply to Thread
Results 1 to 3 of 3

VBA to use User selected range to find and replace

  1. #1
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    VBA to use User selected range to find and replace

    Hi All,

    Coming up short on my code here.

    I'm trying to do a massive find and replace across several columns and worksheets. I want to be able to select the range, then run the macro, and have it replace my designated items.

    My first problem is having VBA recognize my pre-selected range on the active sheet.

    My second problem is I'm not certain my replace code is correct.

    Could anyone help with figuring out this code?

    An example of what I've tried (with the exception that there are many more replacements):

    Please Login or Register  to view this content.
    Thanks!
    -LM

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA to use User selected range to find and replace

    Try:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: VBA to use User selected range to find and replace

    Hi Olly,

    Thank you for the excellent code revision!

    Works perfectly with one caveat. Lets say I have three cells with values, 2, 22, 201. The current test code I provided would turn these into CDD, CDDCDD, CDD01. Is there any way to specify that it has to be an exact match? (i.e. just "2" will not change the 2 in 201, etc.)?

    Thanks!

    **EDIT** I have figured out adding "LookAt:=xlWhole" into the line will solve my query.

    Thanks again Olly for your quick and perfect response!
    Last edited by liquidmettle; 07-31-2016 at 05:19 PM.

+ 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 replace in selected cell over multiple worksheets
    By robnsd in forum Excel General
    Replies: 5
    Last Post: 01-04-2016, 06:24 PM
  2. [SOLVED] Search and Find User on selected sheet
    By alimsab in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-06-2015, 09:03 AM
  3. Replies: 3
    Last Post: 12-01-2014, 12:15 AM
  4. 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
  5. Replies: 2
    Last Post: 05-03-2014, 04:18 PM
  6. [SOLVED] Find and Replace - Value selected at random from a list
    By Rhys_O in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2012, 09:09 AM
  7. Find and Replace in selected cells only
    By Davidns in forum Excel General
    Replies: 5
    Last Post: 03-20-2012, 05:05 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