Jun 20 2018
12:22 PM
- last edited on
Jul 25 2018
10:04 AM
by
TechCommunityAP
Jun 20 2018
12:22 PM
- last edited on
Jul 25 2018
10:04 AM
by
TechCommunityAP
Hi All,
I am learning VBA and tried everything to fix the issue. Hoping best i would get the solution here.
Below is my VBA code.
I have to restrict the area where this code will work(display a tick mark on double click & dissapear if again double clicked). Area should be defined as Column>7&&Column<32&&Row>4.
=====================================================
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If (Target.Column > 7 And Target.Column < 32) And Target.Value <> Chr(214) Then
With Target
.Value = Chr(214) 'Required
.Font.Name = "Symbol" 'Required
.Font.Size = 13
.Font.Bold = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
End With
ElseIf (Target.Column > 7 And Target.Column < 32 And Target.Rows > 1 And Target.Rows < 3) And Target.Value = Chr(214) Then
Target.ClearContents
End If
End Sub
File is attached here. I have to save it as xls as xlsm format is not allowed to upload.
Jun 21 2018 02:46 AM - edited Jun 21 2018 02:47 AM
SolutionDoes this work for you:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Me.Range("H5:DH1000")) Is Nothing Then Exit Sub If Target.Value <> Chr(214) Then With Target .Value = Chr(214) 'Required .Font.Name = "Symbol" 'Required .Font.Size = 13 .Font.Bold = True .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom End With Cancel = True ElseIf Target.Value = Chr(214) Then Target.ClearContents Cancel = True End If End Sub
Jun 26 2018 06:50 AM
Jun 21 2018 02:46 AM - edited Jun 21 2018 02:47 AM
SolutionDoes this work for you:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Intersect(Target, Me.Range("H5:DH1000")) Is Nothing Then Exit Sub If Target.Value <> Chr(214) Then With Target .Value = Chr(214) 'Required .Font.Name = "Symbol" 'Required .Font.Size = 13 .Font.Bold = True .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom End With Cancel = True ElseIf Target.Value = Chr(214) Then Target.ClearContents Cancel = True End If End Sub