PDA

View Full Version : right click



aoc
04-21-2007, 11:52 PM
hi,

in n9 cell, when I right click mouse, I want to see a list containing numbers from 1 to 20.when I right click any number will be seen in the cell .

regards

Aussiebear
04-22-2007, 12:06 AM
Why not make a "list' and have the cell refer to this ?

aoc
04-22-2007, 12:11 AM
hi,

I know, but wonder that way :)

mdmackillop
04-22-2007, 05:31 AM
Why reinvent the wheel? Use Data Validation as Aussiebear suggests.

aoc
04-22-2007, 09:44 AM
hi,

when re-inventing, I might invent something different: )

Aussiebear
04-22-2007, 12:13 PM
Different perhaps.... but would it work?

Charlize
04-23-2007, 03:13 AM
hi,

when re-inventing, I might invent something different: )
If you really want to try, use the before right click event. The code for the numbers is up to you. I suggest using a form (without caption) with a listbox on it.Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
If Sh.Name = "Sheet1" Then
'Right click on A2 to A20 and C2 to C20 on sheet1
If Not Intersect(Target, Range("A2:A20,C2:C20")) Is Nothing Then
Cancel = True
MsgBox "Here the code for the numbers ..."
End If
End If
End Sub
Charlize

ps. When double clicking the listbox on a number you can even insert the chosen number (so you don't need an extra commandbutton.