Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-27-2017, 04:21 PM
Larry_1 Larry_1 is offline I don't understand event handling for the DoubleClick event Windows 10 I don't understand event handling for the DoubleClick event Office 2010 64bit
Novice
I don't understand event handling for the DoubleClick event
 
Join Date: Dec 2017
Posts: 9
Larry_1 is on a distinguished road
Default I don't understand event handling for the DoubleClick event

I'm slowly getting more comfortable with VBA, but I frequently don't understand the logic in sample code that I find on the net. My present problem is understanding the event handling for a double click event.

The upper code is how I edited the sample code (which is commented out). Both seem to function the same.

I understand the logic in my edited version, but not the logic in the sample:
If the intercept is Nothing, doesn't that mean that target cell is not within the designated range? So why the "Not"?
Why did the sample's author use the Not logic (I found a number of postings with this logic); does it have an advantage over my edited logic?
I'd sincerely appreciate any comments that you can offer.

Very respectfully,
Larry



Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    ' If the cell is not within the range B1:B10, then cancel
    ' If the cell is within the range, then act
    If Application.Intersect(Target, Range("B1:B10")) Is Nothing Then
        MsgBox ("is NOT in B1:B10")     '  Action for out-of-range target
        Cancel = True
        Else: MsgBox ("is in B1:B10")   '  Action if target is within the range
    End If
        
  '  Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  '  If Not Application.Intersect(Target, Range("C40")) Is Nothing Then
  '      Cancel = True
  '      SelectPayFreq.Show
  '  End If
  '  End Sub

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Event planning cajos Project 3 03-26-2016 05:19 PM
calendar event not showing licinio Outlook 0 05-18-2015 05:27 AM
I don't understand event handling for the DoubleClick event Document_ContentControlBeforeDelete Event Tejas.T Word VBA 5 02-27-2015 08:01 PM
Hyperlinks in Calendar Event? komobu Outlook 0 07-16-2014 08:09 AM
I don't understand event handling for the DoubleClick event Create calendar event groegee Outlook 1 12-05-2011 09:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft