![]() |
Formula Bar Shortcut Meny Insert
I've got a question about a menu item I've added to the "Formula Bar"
shortcut menu. I'm trying to insert a predefined text string in the cell when the user clicks the menu item. However, it doesn't seem that while you're editing a formula that Excel can run any macros, so I was wondering if anyone had any idea how to do this. This is the code I'm trying to use: Sub InsertPN() strQ = Chr(34) ActiveCell.Value = ActiveCell.Value & "$PRP:" & strQ & "DwgNo" & strQ End Sub And this is the code I used to create the shortcut menu item: Sub Menu() Set FormulaItem = CommandBars("Formula Bar").Controls.Add With FormulaItem .Caption = "Insert P/N" .OnAction = "InsertPN" .BeginGroup = True End With End Sub TIA for any help. -Pete |
Formula Bar Shortcut Meny Insert
Your correct. For any practical purpose, macros don't execute when your are
in edit mode. Perhaps click the menu item before you go into edit mode. -- Regards, Tom Ogilvy "Pete" wrote: I've got a question about a menu item I've added to the "Formula Bar" shortcut menu. I'm trying to insert a predefined text string in the cell when the user clicks the menu item. However, it doesn't seem that while you're editing a formula that Excel can run any macros, so I was wondering if anyone had any idea how to do this. This is the code I'm trying to use: Sub InsertPN() strQ = Chr(34) ActiveCell.Value = ActiveCell.Value & "$PRP:" & strQ & "DwgNo" & strQ End Sub And this is the code I used to create the shortcut menu item: Sub Menu() Set FormulaItem = CommandBars("Formula Bar").Controls.Add With FormulaItem .Caption = "Insert P/N" .OnAction = "InsertPN" .BeginGroup = True End With End Sub TIA for any help. -Pete |
All times are GMT +1. The time now is 07:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com