Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Get line no from right click menu ("Cell")
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Dave Peterson, post: 6456194"] I'm not sure what you're doing where you'd need that many choices inside the rightclick menu. Maybe you could use the activecell.row or the row with the number of rows in the first area of the selection???? But since you're using the .tag property, you could call the same RunMe procedure and just decide based on that .tag of the button you clicked. I don't know what data() does, so I just plopped in some text: Option Explicit Sub auto_open() Dim lCount As Long Dim MyList As Variant Dim lListCount As Long Dim cBut As CommandBarButton lListCount = 4 For lCount = 1 To lListCount MyList = "runme " & lCount Set cBut = Application.CommandBars("Cell").Controls _ .Add(Type:=msoControlButton, Temporary:=True) With cBut .Caption = MyList .Style = msoButtonIconAndCaption ' msoButtonCaption .FaceId = lCount + 50 '.SetFocus .OnAction = ThisWorkbook.Name & "!RunMe" .Tag = lCount End With Next lCount End Sub Sub RunMe() With Application.CommandBars.ActionControl 'MsgBox .Caption & vbLf & .Tag Select Case .Tag Case Is <= 2 MsgBox "it's small" Case Else MsgBox "it's not small" End Select End With End Sub [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Get line no from right click menu ("Cell")
Top