![]() |
question on macro
I am using the following macro to increase the value of a cell on a double
click how. I cannot make it work for columns c,d,e,and f. Can anyone offer any solutions? Private Sub Worksheet_BeforeDoubleClick(ByVal Target _ As Range, Cancel As Boolean) If Target.Row = 1 Then Exit Sub If Target.Column < 2 Then Exit Sub 'Require Col B On Error Resume Next Application.EnableEvents = False Target.Value = Target.Value + 1 Application.EnableEvents = True If Err.Number < 0 Then MsgBox "Unable to add 1 to value in cell " _ & Target.Address(0, 0) End If End Sub |
question on macro
Change
If Target.Column < 2 Then Exit Sub 'Require Col B to If Target.Column < 3 Or Target.Column 7 Then Exit Sub -- HTH RP (remove nothere from the email address if mailing direct) "kara" wrote in message ... I am using the following macro to increase the value of a cell on a double click how. I cannot make it work for columns c,d,e,and f. Can anyone offer any solutions? Private Sub Worksheet_BeforeDoubleClick(ByVal Target _ As Range, Cancel As Boolean) If Target.Row = 1 Then Exit Sub If Target.Column < 2 Then Exit Sub 'Require Col B On Error Resume Next Application.EnableEvents = False Target.Value = Target.Value + 1 Application.EnableEvents = True If Err.Number < 0 Then MsgBox "Unable to add 1 to value in cell " _ & Target.Address(0, 0) End If End Sub |
question on macro
Private Sub Worksheet_BeforeDoubleClick(ByVal Target _
As Range, Cancel As Boolean) If Target.Row = 1 Then Exit Sub If Target.Column < 2 or Target.column 6 Then Exit Sub 'Require Col B On Error Resume Next Application.EnableEvents = False Target.Value = Target.Value + 1 Application.EnableEvents = True If Err.Number < 0 Then MsgBox "Unable to add 1 to value in cell " _ & Target.Address(0, 0) End If End Sub -- Regards, Tom Ogilvy "kara" wrote in message ... I am using the following macro to increase the value of a cell on a double click how. I cannot make it work for columns c,d,e,and f. Can anyone offer any solutions? Private Sub Worksheet_BeforeDoubleClick(ByVal Target _ As Range, Cancel As Boolean) If Target.Row = 1 Then Exit Sub If Target.Column < 2 Then Exit Sub 'Require Col B On Error Resume Next Application.EnableEvents = False Target.Value = Target.Value + 1 Application.EnableEvents = True If Err.Number < 0 Then MsgBox "Unable to add 1 to value in cell " _ & Target.Address(0, 0) End If End Sub |
All times are GMT +1. The time now is 05:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com