Solved

Excel filter by strike though

Posted on 2016-11-25
8
64 Views
Last Modified: 2016-11-30
I have an Excel spreadsheet where certain rows have fields with the font has a strike though
Can I filter these in some way
Gordon
0
Comment
Question by:GiaHughes
  • 4
  • 3
8 Comments
 
LVL 26

Accepted Solution

by:
ProfessorJimJam earned 250 total points
ID: 41901415
you can do this with using a helper cell and UDF


i have created the attached workbook as example.  i put the code below and then see column A has data with some cells  strike though and then i used column B with UDF and then i filtered column B .
Function HasStrike(Rng As Range) As Boolean
HasStrike = Rng.Font.Strikethrough
End Function

Open in new window

Book1.xlsm
0
 
LVL 4

Assisted Solution

by:Elizabeth Anderson
Elizabeth Anderson earned 250 total points
ID: 41901432
Please try the code below -
Sub StrikeOut()
Dim cll As Range
Dim rng As Range
Dim rC As Integer

rC = Sheets("Sheet1").Range("A1").CurrentRegion.Rows.Count 'Gets the last row to check
Set rng = Sheets("Sheet1").Range("A1:A" & rC) ' Sets the range to search through
For Each cll In rng
    If cll.Font.Strikethrough = True Or cll.Offset(0, 1).Font.Strikethrough = True Then 
        cll.Font.Strikethrough = True
        cll.Offset(0, 1).Font.Strikethrough = True
    End If
Next cll
End Sub

Open in new window

0
 

Author Comment

by:GiaHughes
ID: 41901745
Hi
Where do I go in Excel to add these codes
Gordon
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41901794
please download the attached i posted above

it already has the code in it.

if you press ALT+f11 you will see the code in a module.

for more detail on how to place the code on workbook see this link http://www.rondebruin.nl/win/code.htm
0
 

Author Comment

by:GiaHughes
ID: 41902068
OK have worked out how to input the code, have to select the developer option on the ribbin
Now, the column to use is B and not A, what do I change in the following

Sub StrikeOut()
Dim cll As Range
Dim rng As Range
Dim rC As Integer

rC = Sheets("Sheet1").Range("A1").CurrentRegion.Rows.Count 'Gets the last row to check
Set rng = Sheets("Sheet1").Range("A1:A" & rC) ' Sets the range to search through
For Each cll In rng
    If cll.Font.Strikethrough = True Or cll.Offset(0, 1).Font.Strikethrough = True Then
        cll.Font.Strikethrough = True
        cll.Offset(0, 1).Font.Strikethrough = True
    End If
Next cll
End Sub
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 41902122
Please see the attachment on my post , the code you are referring is not mine.
0
 

Author Comment

by:GiaHughes
ID: 41907691
I have read the posts and not sure how to action the codes, so I am sure both solution work, but I don't know how to deal with theses
So closing question
0
 

Author Closing Comment

by:GiaHughes
ID: 41907692
Sorry guys
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question