Trouble Repeating VBA Code

Melroy

New Member
Joined
Jul 11, 2019
Messages
2
Hello,
I'm new to VBA coding.
I found a very useful code that allows me to produce a checkmark when I double click on the task I've just completed. However, for some reason, I can't repeat the action. See code below:

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A10:A41")) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = "?" Then Target.Value = "blank" Else: Target.Value = "?"
End If
End Sub[/FONT]

I need to repeat the above code in three other columns on the same sheet (e.g. F10:F18, L10:L21 and P10:P15). I've searched the internet and found a few solutions, but each time a use them, I get errors that I can't seem to resolve.
Can you kindly provide me with some direction on how to get this to work the way I need it to?
Thank you!
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You can use this line instead of current one:

Code:
If Not Intersect(Target, Union(Range("A10:A41"), Range("F10:F18"), Range("L10:L21"), Range("P10:P15"))) Is Nothing Then
 
Upvote 0
Brilliant - it worked!!!
Thank you.
Just so I add to my learning - what does the "union" formula do?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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