• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Identify mouse double-click on table column cell in a worksheet

inddon

Member
Hello there,

I have a table with 2 columns as below:
-a leading column name "Task"
-corresponding column "Value"

I would like to know how the actual VBA code can be done which can perform this action:

Eg. When I double click on table row 1, column 'Value' cell, it should display a message that the user has clicked on the corresponding Task's Value.

To understand it correclty, please find attached the sample workbook for your reference for more details.

Thank you & regards,
Don
 

Attachments

  • Sample Workbook.xlsm
    22.6 KB · Views: 5
Code:
Option Explicit

Private Sub WorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target(1, 1).Column = 4 Then
  If Not Intersect(Target, Range("Table1")) Is Nothing Then
     MsgBox "You have clicked on " & ActiveCell.Offset(0, -1).Value & " " & ActiveCell.Value
     Cancel = True
  End If
End If

End Sub
 
Code:
Option Explicit

Private Sub WorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target(1, 1).Column = 4 Then
  If Not Intersect(Target, Range("Table1")) Is Nothing Then
     MsgBox "You have clicked on " & ActiveCell.Offset(0, -1).Value & " " & ActiveCell.Value
     Cancel = True
  End If
End If

End Sub
Thank you Logit
 
Back
Top