gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
How can I write this VBA code so that the double click range is limited to D3:D25…
- User
How can I write this VBA code so that the double click range is limited to D3:D25
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.EnableEvents = False Dim doubleClickedCell As Range Set doubleClickedCell = Target.Cells(1) If Target.CountLarge > 1 Then Exit Sub If Target.Column = 4 Then ' Column D PlanService Target previousValue = doubleClickedCell.Value doubleClickFlag = True End If Application.EnableEvents = True End Sub
- Assistant
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.EnableEvents = False Dim doubleClickedCell As Range Set doubleClickedCell = Target.Cells(1)
If Target.CountLarge > 1 Then Exit Sub If Not Intersect(Target, Range("D3:D25")) Is Nothing Then ' Limit range to D3:D25 If Target.Column = 4 Then ' Column D PlanService Target previousValue = doubleClickedCell.Value doubleClickFlag = True End If End If Application.EnableEvents = TrueEnd Sub