+ Reply to Thread
Results 1 to 4 of 4

Running a partial string formatting macro more than once messes up

  1. #1
    Registered User
    Join Date
    04-29-2016
    Location
    Berlin, Germany
    MS-Off Ver
    2019
    Posts
    4

    Question Running a partial string formatting macro more than once messes up

    I am trying to run a macro to format parts of the strings in each cell according to different conditions. Each string may contain multiple different formats. The problem is that it works perfectly if I reset the data and run the macro once. If I run it more than that, the unformatted parts of the string, take the formatting of the first character in the cell. I want the unformatted parts to retain whatever formating they had before the macro runs multiple times and not change.

    I have attached a dummy file with both a reset and a clean up (the macro I want) button. Just click any cell in "Col 2" for them to appear. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Running a partial string formatting macro more than once messes up

    The issue appears to be occurring on the line

    Please Login or Register  to view this content.
    As you have converted to lower case the first time, you don't need to on subsequent occasions

    Try this

    Please Login or Register  to view this content.
    Martin

  3. #3
    Registered User
    Join Date
    04-29-2016
    Location
    Berlin, Germany
    MS-Off Ver
    2019
    Posts
    4

    Re: Running a partial string formatting macro more than once messes up

    Thanks, but this partially works. Whenever the initial string's formatting isn't completely uniform and the macro runs, things go haywire and sometimes Excel just needs to quit.

    I've attached an updated version to further explain the problem.
    Attached Files Attached Files

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Running a partial string formatting macro more than once messes up

    Hmmmm....

    Might be worth trying putting a DoEvents statement inside your loop to allow Excel to let other processes catch up frequently.

+ 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. Replies: 14
    Last Post: 04-21-2017, 04:56 PM
  2. Formatting of Email Messes Up When I Include the Signature
    By Ross24 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2015, 07:23 PM
  3. [SOLVED] VBA / Macro help needed for matching partial text string
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2013, 09:41 PM
  4. Trying to match partial string with another string and give position or cell
    By pat3white in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 07-01-2013, 10:07 AM
  5. [SOLVED] Vlookup, Match (Search or Find) partial string within string in a Cell
    By dluhut in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-28-2013, 12:40 PM
  6. Vba conditional formatting macro partial running
    By OzNoz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2011, 03:17 AM
  7. Pivot Table graph looses formatting after running formatting macro
    By arthurbr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2011, 04:16 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