Consulting

Results 1 to 2 of 2

Thread: A way to filter based on strikethrough formatting?

  1. #1

    A way to filter based on strikethrough formatting?

    Hello,
    I am using Excel 2010. I have a file with data in columns A to AB and about 15,000 rows of data. Any one or more cells per row may have strikethrough formatting applied. I want to identify all records with any strikethrough format applied, whether to one cell in the row or all cells in the row. My end goal is to separate any row with strikethrough formatting to move these rows to a different worksheet. Any advice on how to accomplish this will be greatly appreciated!

    Thank you in advance for your time!!

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    welcome to vbax.

    try:
    Sub vbax_55413_filter_copy_strikethrough_formatted_cells()
    
    
        Dim i As Long, j As Long
        
        With Worksheets("SourceSheet") 'change SourceSheet to suit
            .AutoFilterMode = False
            .Cells(1, 29).Value = "Strikethrough?" 'AC1
            For i = 2 To .Cells(.Rows.Count, 1).End(xlUp).Row
                For j = 1 To .Cells(1, .Columns.Count).End(xlToLeft).Column
                    If .Cells(i, j).Font.Strikethrough = True Then
                        .Cells(i, 29).Value = "Yes"
                        Exit For
                    End If
                Next j
            Next i
            .Cells(1).AutoFilter Field:=29, Criteria1:="=Yes"
            .AutoFilter.Range.Resize(, 28).Copy Worksheets("DestinationSheet").Cells(1) 'change DestinationSheet to suit
            .UsedRange.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Delete
            .AutoFilterMode = False
            .Columns(29).Clear
        End With
    
    
    End Sub
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

Posting Permissions

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