delete rows that have strike-through values in column A

W

William Poh Ben

Hi EXCEL expert,

I know of a VBA code that can delete empty rows in a range of data. But
I wonder is there a VBA code that can delete the rows
that have, say, in column A cells that contain "strike-through" values.
Column A contains PartNumber in both numeric and alpha-numeric values.

A successful VBA code will really save me a lot of time in office
work.
Appreciate very much any help offer !
 
J

J.E. McGimpsey

one way:

Public Sub DeleteStrikeThroughs()
Dim cell As Range
Dim delRange As Range

For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
If cell.Font.Strikethrough Then
If delRange Is Nothing Then
Set delRange = cell
Else
Set delRange = Union(delRange, cell)
End If
End If
Next cell
If Not delRange Is Nothing Then delRange.EntireRow.Delete
End Sub


Note: This assumes that strikethrough format was applied to the
cell, not to only some characters within the cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top