Double Click Event

RLJ

Active Member
Joined
Mar 15, 2011
Messages
417
Office Version
  1. 365
Platform
  1. Windows
How can I change this code to work with a Defined Name "QC"?

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As 
Boolean) 
    If Target.Column <> 4 Then Exit Sub ' choose column Number 
    If Target.Count > 1 Then Exit Sub 
    If Target.Value = "" Then 
        Target.Font.Name = "Marlett" 
        Target = "a" 
    Else 
        Target.Font.Name = "Arial" ' set to your normal default font 
        Target = "" 
    End If 
End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Intersect(Target, Range("QC")) Is Nothing Then Exit Sub ' choose column Number
    If Target.Count > 1 Then Exit Sub
    Cancel = True
    If Target.Value = "" Then
        Target.Font.Name = "Marlett"
        Target.Value = "a"
    Else
        Target.Font.Name = "Arial" ' set to your normal default font
        Target.ClearContents
    End If
End Sub
 
Upvote 0
Change
Code:
If Target.Column <> 4 Then Exit Sub ' choose column Number
to
Code:
If Intersect(Target,Range("QC"))Is Nothing Then Exit Sub
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,510
Members
452,918
Latest member
Davion615

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