Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 638
Default Can I sort or filter or delete by strike-through?

Couple different ways to do this. You could use a function:
Function isStriked(cellTest As Range) As Boolean
Application.Volatile
If cellTest.Font.Strikethrough Then
isStriked = True
Else
isStriked = False
End If
End Function

Then, in a helper column, you could use something like
=isStriked(A2). It will return the word True if A2 is striked and
False if it isn't. Sort on the column, filter on the column,
whatever.

Or you could use a loop to cycle through a range of cells and delete
the whole row if the cell in the range is striked.
Sub deleteStrikes()
Dim rNum As Long
rNum = Cells(Rows.Count, 1).End(xlUp).Row
For i = rNum To 2 Step -1
If Cells(i, 1).Font.Strikethrough Then _
Cells(i, 1).EntireRow.Delete
Next i
End Sub

Annie1904 wrote:
I've got a huge database in Excel, and many of the records have had text
formatted with a strike-trhough. Initially, this was so I could track what
had been 'deleted', but now I want to remove those records. Rather than go
through them individually, is there a quicker way?


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 638
Default Can I sort or filter or delete by strike-through?

After reading Dave's post, I feel I better clarify the code I posted
earlier. The function and the sub will only work if the whole cell is
formatted as strikethrough.
JW wrote:
Couple different ways to do this. You could use a function:
Function isStriked(cellTest As Range) As Boolean
Application.Volatile
If cellTest.Font.Strikethrough Then
isStriked = True
Else
isStriked = False
End If
End Function

Then, in a helper column, you could use something like
=isStriked(A2). It will return the word True if A2 is striked and
False if it isn't. Sort on the column, filter on the column,
whatever.

Or you could use a loop to cycle through a range of cells and delete
the whole row if the cell in the range is striked.
Sub deleteStrikes()
Dim rNum As Long
rNum = Cells(Rows.Count, 1).End(xlUp).Row
For i = rNum To 2 Step -1
If Cells(i, 1).Font.Strikethrough Then _
Cells(i, 1).EntireRow.Delete
Next i
End Sub

Annie1904 wrote:
I've got a huge database in Excel, and many of the records have had text
formatted with a strike-trhough. Initially, this was so I could track what
had been 'deleted', but now I want to remove those records. Rather than go
through them individually, is there a quicker way?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can I sort or filter or delete by strike-through?

But it wouldn't be difficult to modify based on what the OP really wants.

As written, the cell has to be formatted as strikethrough. And that could be
what the OP really wants.

JW wrote:

After reading Dave's post, I feel I better clarify the code I posted
earlier. The function and the sub will only work if the whole cell is
formatted as strikethrough.
JW wrote:
Couple different ways to do this. You could use a function:
Function isStriked(cellTest As Range) As Boolean
Application.Volatile
If cellTest.Font.Strikethrough Then
isStriked = True
Else
isStriked = False
End If
End Function

Then, in a helper column, you could use something like
=isStriked(A2). It will return the word True if A2 is striked and
False if it isn't. Sort on the column, filter on the column,
whatever.

Or you could use a loop to cycle through a range of cells and delete
the whole row if the cell in the range is striked.
Sub deleteStrikes()
Dim rNum As Long
rNum = Cells(Rows.Count, 1).End(xlUp).Row
For i = rNum To 2 Step -1
If Cells(i, 1).Font.Strikethrough Then _
Cells(i, 1).EntireRow.Delete
Next i
End Sub

Annie1904 wrote:
I've got a huge database in Excel, and many of the records have had text
formatted with a strike-trhough. Initially, this was so I could track what
had been 'deleted', but now I want to remove those records. Rather than go
through them individually, is there a quicker way?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I sort or filter or delete by strike-through? Dave Peterson Excel Discussion (Misc queries) 0 October 12th 07 02:07 PM
AFTER 8 SEC ON SPACEBAR I GOT A FILTER?DELETE IT? Carl Excel Discussion (Misc queries) 2 June 16th 07 02:05 PM
Filter list and delete OfficeNDN Excel Discussion (Misc queries) 4 September 11th 06 04:08 PM
filter and delete Jordan Excel Worksheet Functions 1 July 7th 05 07:18 PM
Fastest Way to Filter/Delete SyrHoop Excel Worksheet Functions 6 November 10th 04 06:33 PM


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"