Double click cell to add a value to another cell in that row

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Morning,
My current range is S4 & down the page.
I wish to double click a cell in column A to then add the value DEL in column S on that same row.

So if the user double clicks in cell A27 the value DEL should be entered in cell S27

Same for cell A123 then S123 should also have DEL entered into it

I have this below but stuck with the adding of DEL in the cell.

Rich (BB code):
  Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
   
   If Not Intersect(Range("S4", Cells(Rows.Count, "S").End(xlUp)), Target) Is Nothing Then
  
      Cancel = True
  
      Active.Row.Value = ("DEL")
     
   End If

End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Maybe this?
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Range("A4:A" & Cells(Rows.Count, "S").End(xlUp).Row), Target) Is Nothing Then
        Application.EnableEvents = False
        Cancel = True
        Target.Offset(, 18).Value = "DEL"
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0
Solution
Works well thanks.

So the following means the target is 18 columns after the cell that is being double clicked ?

Rich (BB code):
Target.Offset(, 18).Value = "DEL"
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,112
Members
449,096
Latest member
provoking

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