VBA Strikethrough sheet tab name with checkbox

EtienneD

New Member
Joined
Jul 21, 2022
Messages
27
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have 5 worksheets that represent 5 different lists of tasks. When all the tasks are done in one sheet, I want to be able to to see it quickly. So I would like to have a checkbox that either strikethrough that tab name so we know it's all done. I know how to add the checkbox, name it with the tab name I want to modify , and assign the macro to the checkbox. I just needhelp with the formula please.

Thanks to you all
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
strikethrough that tab name
Where exactly do you want to strike through the tab name? On the tab? Cannot be done. In the checkbox caption? Cannot be done. In a cell?
 
Upvote 0
The actual tab name at the bottom.
1658408119678.png
 
Upvote 0
As has been said you cannot do that, however you could change the colour of the tab instead.
 
Upvote 0
Actually, if you use combined unicode text (ChrW(&H336)), you could add a stroke though the sheets tab names as requested.

Here is a routine that does that:

In a Standard Module:
VBA Code:
Option Explicit


Sub StrikeThrough_Worksheet_Tab(ByVal WS As Worksheet)

    Const MAX_CHARS = 15
    Dim i As Long, sTmp As String
 
    With WS
        If AscW(Mid(.Name, 1, 1)) = &H336 Then Exit Sub
        If Len(.Name) > MAX_CHARS Then Exit Sub
        For i = 1 To Len(.Name)
            sTmp = sTmp & ChrW(&H336) & Mid(.Name, i, 1)
        Next i
        .Name = sTmp & ChrW(&H336)
    End With

End Sub

The following should add a strikethrough to sheets(1) tab:
VBA Code:
Sub Test()
    Call StrikeThrough_Worksheet_Tab(WS:=Sheets(1))
End Sub

Because, the text is now combined it is double the size of the original tab text and therefore the above will only work if the original tab text has a maximum of 15 characters. (By default, sheet tab names can't exceed 31 chars)
 
Last edited:
Upvote 0
Actually, if you use combined unicode text (ChrW(&H336)), you could add a stroke though the sheets tab names as requested.

Here is a routine that does that:

In a Standard Module:
VBA Code:
Option Explicit


Sub StrikeThrough_Worksheet_Tab(ByVal WS As Worksheet)

    Const MAX_CHARS = 15
    Dim i As Long, sTmp As String
 
    With WS
        If AscW(Mid(.Name, 1, 1)) = &H336 Then Exit Sub
        If Len(.Name) > MAX_CHARS Then Exit Sub
        For i = 1 To Len(.Name)
            sTmp = sTmp & ChrW(&H336) & Mid(.Name, i, 1)
        Next i
        .Name = sTmp & ChrW(&H336)
    End With

End Sub

The following should add a strikethrough to sheets(1) tab:
VBA Code:
Sub Test()
    Call StrikeThrough_Worksheet_Tab(WS:=Sheets(1))
End Sub

Because, the text is now combined it is double the size of the original tab text and therefore the above will only work if the original tab text has a maximum of 15 characters. (By default, sheet tab names can't exceed 31 chars)
Thanks for your help! Can the strike appear when a checkbox is checked?
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top