[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

Excel macro double-click

Hi, I want to create a macro that pops up a message when I double-click a cell. Is this possible?
Can anyone help?
0
HKFuey
Asked:
HKFuey
  • 2
1 Solution
 
gtglonerCommented:
Try this code in whichever sheet you want the box to appear:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

 MsgBox ("test message")

End Sub

Open in new window

0
 
HKFueyAuthor Commented:
Superb, just what I needed, thanks!
0
 
gtglonerCommented:
Thanks. As a follow up, if you needed the message box to show for double clicking on only one cell rather than any cell in the sheet, this code would be sufficient:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
 
 Dim LookIn As Range

    Set LookIn = Me.Range("A1")

    If Intersect(Target, LookIn) Is Nothing Then Exit Sub
    If ActiveCell = LookIn Then
    MsgBox ("Test message")
    End If
    
End Sub

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now