+ Reply to Thread
Results 1 to 2 of 2

VBA - replace text within range with contents of another range

  1. #1
    Registered User
    Join Date
    06-01-2014
    Posts
    3

    VBA - replace text within range with contents of another range

    Hi Pros,

    I have a spreadsheet that has data in 2x separate columns (around 150 rows long), named "range1" and "range2". The data in "range1" (Col A) might contain the text "xxx", in which case I want to replace with the text in the coresponding "range2" (Col F). I know that i can probably write code using For Next function to run down the column and make the replacements, but have been trying to use the bulk replace function instead to simply the overall code. Alas, not having much luck! Is this possible to achieve? Here is a sample of the (wrong) code that I am trying to write....... Thanks.


    Please Login or Register  to view this content.
    Last edited by grantnorton; 06-16-2018 at 04:27 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,885

    Re: VBA - replace text within range with contents of another range

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. VBA to Clear contents from a range if text appears in a certain cell
    By sherman51 in forum Excel Programming / VBA / Macros
    Replies: 40
    Last Post: 01-20-2018, 04:07 PM
  2. [SOLVED] Replace contents of blank range with contents of the next non-blank range
    By wpryan in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-03-2015, 09:47 AM
  3. [SOLVED] Loop Through Range, Find Text, and Replace Text
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2014, 12:01 PM
  4. Search Text of Cell in a range and return the contents
    By knowing in forum Excel General
    Replies: 8
    Last Post: 11-19-2012, 08:57 AM
  5. [SOLVED] How do I clear contents from a range excluding formulas and text?
    By Normezo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2012, 10:36 AM
  6. Search Text of Cell in a range and return the contents
    By shanipk82 in forum Excel General
    Replies: 3
    Last Post: 11-26-2010, 01:34 PM
  7. [SOLVED] replace a range of #'s e.g. 1.25 to 100 with text in excell
    By Painter in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-27-2005, 04:40 PM

Tags for this Thread

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