+ Reply to Thread
Results 1 to 6 of 6

Check if font in cell is strikethrough

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Check if font in cell is strikethrough

    Hello,

    Plese see attached workbook cell A1.
    I am running the following script to check if the cell font is a strikethrough.

    Please Login or Register  to view this content.

    The script returns "The content of the cell is not strikethrough." even though the cell is a stikethrough font.
    Interestingly, if I type anything in the cell, it will return : "The content of the cell is a strikethrough."

    What should I do to rectify this?
    I have a long spreadsheet to check; tried to copy / paste values before running the script but that doesn't help.
    Could you please advise?

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Check if font in cell is strikethrough


    Hello,

    something weird in the cell formatting so first just cancel strikethrough then once done retry strikethrough …
    By the way it can be achieved with a single codeline only !
    Just remove the useless from your code like On Error and the range variable as well
    just using directly ActiveCell like you can see in the VBA help sample of strikethrough.

  3. #3
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Check if font in cell is strikethrough

    Mark,
    Thanks for looking into this.
    I cannot cancel the strikethrough because the purpose of this script is to detect which cells are striked out.
    So, if I would go and cancel it out, then all my cells will be non strikethrough which defeats the purpose.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Check if font in cell is strikethrough


    plank you just misread so try again ! As your terrible code works on my side …
    Last edited by Marc L; 05-24-2023 at 07:33 PM.

  5. #5
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    593

    Re: Check if font in cell is strikethrough

    I was able to accomplish what I need with this script:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb Re: Check if font in cell is strikethrough


    As once the useless is removed that just needs an unique codeline : MsgBox IIf(ActiveCell.Font.Strikethrough, "Yes", "No")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Problem of "strikethrough" command for a cell & check-boxes
    By Ben9108 in forum Excel General
    Replies: 7
    Last Post: 06-01-2021, 10:18 AM
  2. change cell font to strikethrough on another sheet based on cell color
    By mlarson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-13-2018, 01:47 PM
  3. loop to check cell contains strikethrough/underline
    By dweebz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-26-2016, 02:56 AM
  4. Column Filter based on Font or Strikethrough
    By piperjack in forum Excel General
    Replies: 0
    Last Post: 12-12-2012, 03:48 PM
  5. Counting text cells with strikethrough font!
    By Spellbound in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-19-2007, 11:23 AM
  6. Count cells with strikethrough font?
    By Mike Echo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-04-2005, 04:45 AM
  7. [SOLVED] Strikethrough and Underline Font Macro
    By Rainman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-07-2005, 06:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1