+ Reply to Thread
Results 1 to 11 of 11

Colouring Strikethrough/Underline text within a cell via Loop

  1. #1
    Registered User
    Join Date
    05-19-2016
    Location
    Melbourne
    MS-Off Ver
    1
    Posts
    23

    Colouring Strikethrough/Underline text within a cell via Loop

    Hi Everyone,

    With the help of members on the ExcelForum, I have managed to come up with a code which:

    Finds the last column in the worksheet, then colours every strikethrough text blue, and every underlined text in red in each cell, from the identified first row of the last column, up until the last row of the last column. Below is my working code.

    I'm just wondering if there is anyway to optimise the colouring process? It roughly takes 3minutes to process 700 lines within the worksheet, within the identified column range.

    Thank you in advance


    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    I just had a thought, if you have a number of cells in the column with null values you could add in a condition to skip those from checking for strikethroughs or underlines.
    I don't know how much time it will save?!?

    Please Login or Register  to view this content.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  3. #3
    Registered User
    Join Date
    05-19-2016
    Location
    Melbourne
    MS-Off Ver
    1
    Posts
    23

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    thank you very much for your ongoing help spitfireblue, you seem to know alot about excel vba! haha

    Yes, I just ran the code on 700 lines and it approx takes 4 minutes. Trying to find a way to make it go faster, maybe less than 30 seconds.

    A friend said he has seen it done, but doesn't know how to code it. :/

    Is there any other way I can approach this? Maybe optimising the loop or something?

  4. #4
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    Not that I can spot. Have you tried turning off calculation of formulas?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-19-2016
    Location
    Melbourne
    MS-Off Ver
    1
    Posts
    23

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    Yes I have turned it off but still can't get it to work faster.

  6. #6
    Registered User
    Join Date
    05-19-2016
    Location
    Melbourne
    MS-Off Ver
    1
    Posts
    23

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    I was just thinking, maybe if we skip unused cells too? Could speed up the process...

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    Please Login or Register  to view this content.
    see if this section makes it faster
    it skips things of no interest
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  8. #8
    Registered User
    Join Date
    05-19-2016
    Location
    Melbourne
    MS-Off Ver
    1
    Posts
    23

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    thank you for your code humdingaling. just ran a test and that code takes 4 minutes

  9. #9
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    guess there wasn't much skipping going on then....

  10. #10
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    You must have a lot of characters in each cell and most cells have an underline or a strike-through somewhere in the cell. I don't think you will get it done much quicker.

  11. #11
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Colouring Strikethrough/Underline text within a cell via Loop

    You might try changing the colors in bulk rather than one by one

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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] Colouring loop
    By GoonerJed in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2013, 07:37 AM
  2. Align msgbox text and Bold & underline certain text
    By alexnkc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 11:01 PM
  3. [SOLVED] formula/function to change text to strikethrough if condition met in adj cell
    By spreadsheetdummy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-04-2012, 10:35 PM
  4. Strikethrough Red and Underline Blue Macro
    By Rainman76 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-28-2011, 04:41 AM
  5. Underline e-mail address in cell with other text?
    By leaning in forum Excel General
    Replies: 5
    Last Post: 10-10-2010, 12:46 AM
  6. Replies: 4
    Last Post: 02-11-2006, 04:20 PM
  7. formatting (underline/bold/strikethrough) in comment boxes
    By adam l via OfficeKB.com in forum Excel General
    Replies: 3
    Last Post: 11-08-2005, 02:00 PM
  8. [SOLVED] Strikethrough and Underline Font Macro
    By Rainman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-07-2005, 06:05 PM

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