Strikethrough columns A-J with double click

sdl93

New Member
Joined
Aug 24, 2022
Messages
3
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

So I'm a bit of a novice when it comes to excel and I'm looking for a bit of advice/guide on achieving the above. I have a huge list of over 2000 tasks that my work is working through. I want to be able to strikethrough the whole row from columns A-J with either a double click or checkbox once the task is complete.

It seems the double-click method may be the easiest to achieve, I tried to figure it out using checkboxes but realised they would need to be manually linked, which just isn't feasible with over 2000 entries. Any help in this matter would be greatly appreciated. Below is an example of how I would like it to look. Is this possible with one double-click or would it need to be each column?


Capture.JPG
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi ,

maybe this could work for you ? (where I have defined my range as A2:f12 for example - as the area of click)

VBA Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    
    If Not Intersect(Target, Me.Range("A2:f12")) Is Nothing Then
        With Sheet1
            Target.EntireRow.Font.Strikethrough = True
        End With
    End If
End Sub
 
Upvote 0
Hi ,

maybe this could work for you ? (where I have defined my range as A2:f12 for example - as the area of click)

VBA Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
   
    If Not Intersect(Target, Me.Range("A2:f12")) Is Nothing Then
        With Sheet1
            Target.EntireRow.Font.Strikethrough = True
        End With
    End If
End Sub
Thanks so much! This worked a treat. Is it possible to add in a line that would remove the strikethrough on another double-click?
 
Upvote 0
Welcome to the Board!

Here is my version of the code that will automatically strikethrough columns A-J of any row that you double-click in.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    
    Dim r As Long
    
'   Get row double-clicked in
    r = Target.Row
    
'   Strike through columns A-J of that row
    Range("A" & r & ":J" & r).Font.Strikethrough = True
    
    Cancel = True
    
End Sub

Note that this code MUST be placed in the proper sheet module!
 
Upvote 0
this will do it for you, put this in the worksheet code module:
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    With Range("A:I").Font
        .Strikethrough = True
    End With
End Sub
 
Upvote 0
Hi ,

maybe this could work for you ? (where I have defined my range as A2:f12 for example - as the area of click)

VBA Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
   
    If Not Intersect(Target, Me.Range("A2:f12")) Is Nothing Then
        With Sheet1
            Target.EntireRow.Font.Strikethrough = True
        End With
    End If
End Sub
Just note that will strikethrough ALL the columns in the row, not just columns A-J, as was requested.
 
Upvote 0
or this if you just wish to operate on the whole sheet. (remember Sheet1 = name of your worksheet, so you might need to change that in both sets of code if yours is called something different.

VBA Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    
        With Sheet1
            Target.EntireRow.Font.Strikethrough = True
        End With
    
End Sub
 
Upvote 0
OK, here is a version that will only affect columns A-J if you click in columns A-J and will toggle back-and-forth between strikethrough and not strikethrough:
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    
    Dim r As Long
    Dim rng As Range
    
'   Limit select range to columns A-J
    Set rng = Range(Target, Range("A:J"))
    If rng Is Nothing Then
        Cancel = True
        Exit Sub
    End If
    
'   Get row double-clicked in
    r = Target.Row
    
'   Strike through columns A-J of that row
    Range("A" & r & ":J" & r).Font.Strikethrough = Not (Range("A" & r).Font.Strikethrough)
    Cancel = True
    
End Sub
 
Upvote 0
or this if you just wish to operate on the whole sheet. (remember Sheet1 = name of your worksheet, so you might need to change that in both sets of code if yours is called something different.

VBA Code:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
   
        With Sheet1
            Target.EntireRow.Font.Strikethrough = True
        End With
   
End Sub
That usually isn't necessary to designate the sheet name. By default, "Worksheet" event procedure code is found in the specific worksheet tab of the sheet that you want to run it against.
It is meant to run against that worksheet only, by default. So you usually don't need to qualify sheet names, unless you specifically want to run it against other sheets (which does not appear to be the case here).
 
Upvote 0
If you don't / can't use vba then you could perhaps use Conditional Formatting?

Use a Custom formula similar to below. And in the Font tab, tick Effects option for Srikethrough

MXLBook1 (version 1).xlsb
ABCDEFGHIJK
1HeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderHeaderStatus
2StuffExampleStuffStuffStuffStuffStuffStuffStuffStuffDone
3StuffExampleStuffStuffStuffStuffStuffStuffStuffStuff
4StuffExampleStuffStuffStuffStuffStuffStuffStuffStuff
5StuffExampleStuffStuffStuffStuffStuffStuffStuffStuff
6StuffExampleStuffStuffStuffStuffStuffStuffStuffStuffDone
7StuffExampleStuffStuffStuffStuffStuffStuffStuffStuffDone
8StuffExampleStuffStuffStuffStuffStuffStuffStuffStuff
9StuffExampleStuffStuffStuffStuffStuffStuffStuffStuff
10
11
12
13
14
Destination
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:J2000Expression=$K2="Done"textNO


EDIT: The CF doesn't render in the above XL2BB but will in the sheet proper.
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,265
Members
449,149
Latest member
mwdbActuary

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