I have a custom right click menu. I have a loop using values of cells in a range as the captions in a submenu. I want the onaction for each button in the submenu to insert a value of a cell the is next to the cell that was used as the caption for that button.
If the button labeled "Call Center - Center Interpreted Information Incorrectly", I want the onaction procedure to insert the code in col A in the same row as the name of that button, and insert it into a cell. Here is my code so far.
If the button labeled "Call Center - Center Interpreted Information Incorrectly", I want the onaction procedure to insert the code in col A in the same row as the name of that button, and insert it into a cell. Here is my code so far.
Code:
With Application.CommandBars("Cell").Controls
Set SubMenuItem1 = .Add(Type:=msoControlPopup, ID:=1)
With SubMenuItem1
.Caption = "Add Problem Code"
.OnAction = ""
.BeginGroup = False
End With
Dim rCell As Range
Dim rRng As Range
Set rRng = Sheets("Code Conversion").Range("A2:A87")
For Each rCell In rRng.Cells
Desc = rCell.Offset(0, 7)
Code = rCell
With SubMenuItem1.Controls.Add
.Caption = Desc
.OnAction = "AddCode"
.BeginGroup = False
End With
Next rCell
End With