Consulting

Results 1 to 3 of 3

Thread: Faster way delete strikethrough

  1. #1
    VBAX Regular
    Joined
    Sep 2017
    Posts
    24
    Location

    Faster way delete strikethrough

    Hi

    I am currently using this method which I found on the net to delete any cell in a specific column that has strikethrough

    Dim rng As Range, cl As Range   
    Dim i As Long
        Set rng = Range("E:E")
        For Each cl In rng.Cells
        For i = Len(cl.Value) To 1 Step -1
            If cl.Characters(i, 1).Font.Strikethrough Then
                cl.Characters(i, 1).Delete
            End If
        Next i, cl
    It works fine but it looks like it checks every character in the string (I only need to delete whole cell content as this will always be the case), therefore is a little slow, couple of seconds per run.

    I also am using same method to find various other formats like RGB font colour. So when these all run sequentially the processing time adds up

    Is there a better way to apply this either with no loop or faster loop?

    Thank you

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    For Each cl In rng.SpecialCells(2)

  3. #3
    VBAX Regular
    Joined
    Sep 2017
    Posts
    24
    Location
    Wow, a lot quicker thank you very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •