+ Reply to Thread
Results 1 to 4 of 4

VBA Replace problem

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    VBA Replace problem

    I have a bigger macro which after the calculations have been done, needs to do a Text to column on that column of the formulas.
    Before I do this text to column I first convert all the formulas to values except the first formula (want to keep that for reference).

    My excel uses ' ; ' in formulas and after the text to column the formula is changed to be separated by ' , '.
    Now of course that formula will not work anymore.

    So I wanted to change it all back again with a simple replace in VBA.
    But this is not working somehow.

    Strange thing is that even when I record the macro i will not work when I use that recorded macro.

    I attached a workbook. It has 2 codes (1 of 2 is blocked).
    Both I would expect to work but they don't.
    The blocked one is the one I recorded.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: VBA Replace problem

    The trick I use for temporarily changing formulas to text is to replace "=" with "$=". That stops Excel from getting confused between text that begins with "=" and formulas (that always begin with "=").

    Try:
    1. Replace "=" with "$="
    2. Text-to-columns using whichever delimiter your Excel uses
    3. Replace "$=" with "="
    Design everything to be as simple as possible, but no simpler.

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: VBA Replace problem

    Well....that works like a charm Stormin
    Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    03-16-2017
    Location
    UK
    MS-Off Ver
    2016
    Posts
    371

    Re: VBA Replace problem

    Happy to help

+ 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. Find and Replace problem
    By mark99th in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2012, 02:06 PM
  2. [SOLVED] Problem with Find and Replace
    By mjhill01 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 11:05 AM
  3. [SOLVED] Problem with Find and Replace
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 09:05 AM
  4. [SOLVED] Problem with Find and Replace
    By mjhill01 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM
  5. Problem with Find and Replace
    By mjhill01 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. Problem with Find and Replace
    By mjhill01 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  7. Replace Text problem
    By ramonacv in forum Excel General
    Replies: 0
    Last Post: 02-03-2005, 09:42 PM
  8. [SOLVED] problem with replace (VB)
    By Sieto Verver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2005, 09:06 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