Right click menu

SQUIDD

Well-known Member
Joined
Jan 2, 2009
Messages
2,104
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Good Morning

So i am using right click to run some code, but having issues with the right click menu.

code below

if i click in column G, i do not get a right click menu, if i click in B i do get the right click menu.

PO_NUMBER is in column B
NOTE is in column G

Would anyone know what i am doing wrong, its driving me crazy, thanks

Dave


VBA Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Dim myShell As Object
If Cells(5, Target.Column).Value = "PO_NUMBER" Then
    If Not Intersect(Target, [A1:J1500]) Is Nothing Then
        With CHANGE_STATUS
            .TBPO = ActiveCell.Value
            .LOAD_PO.Value = True
        End With
        CHANGE_STATUS.Show vbModeless
        Exit Sub
    End If
End If

If Cells(5, Target.Column).Value Like "*NOTE*" Then
    If Not Intersect(Target, [A1:J1500]) Is Nothing Then
        With ADD_NOTE
            .TBPO = Cells(ActiveCell.Row, 2).Value
            .LOAD_PO.Value = True
        End With
        ADD_NOTE.Show vbModeless
        Exit Sub
    End If
End If

End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
With Cancel = True as the first line, you shouldn't be seeing a right click menu at all regardless of column.

The only thing that comes to mind is that you are setting EnableEvents to False in some other code and not setting it back to True when it finishes.
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,604
Members
449,321
Latest member
syzer

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