Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding right click menu item to insert a blank row
Hi,
I often use the row right click menu to add a row. I find that when I have something on my clipboard the "Insert" command is replaced with a "Insert copied cells" I find this a pain as I have to press escape to cancel the copy command, insert the row, go back to where the source is and copy it again. I was hoping to be able to add a menu item to the row right click menu to add an entire row, that way when I have something on my clipboard I can at least insert the row without having to cancel the command and reselect to insert. I have written the following coder to add an "Insert entire row to the row right click menu: Option Explicit Public RtClkRowMenu As CommandBarButton Sub DDeleteSKBRightClickRowMenuControl() Dim i As Long Dim caption_names As Variant caption_names = Array("Insert Entire Row", "caption 2", "caption 3") With Application.CommandBars("Row") For i = LBound(caption_names) To UBound(caption_names) On Error Resume Next .Controls(caption_names(i)).Delete On Error GoTo 0 Next i End With End Sub And the following code to insert an entire row: Sub IInsertEntireRow() Dim strStartCell As String strStartCell = ActiveCell.Address ActiveCell.Rows("1:1").EntireRow.Select Selection.Insert Shift:=xlDown Range(strStartCell).Select 'Leave cursor in cell that was initially selected End Sub The problem I am having is that when I have something on my clipboard and use my custom right click menu item the contents of the clipboard are pasted into every cell in the row that I have just inserted. Is there a way to get a blank row inserted without the contents of the clipboard being pasted into every cell? Ideally I would like to keep the clipboard contents on the clipboard so that they can be pasted in after the row has been inserted. Any assistance/explanation will be appreciated. Regards. Sean |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add menu item to right click | Excel Programming | |||
Adding a item to the right click menu? | Excel Programming | |||
Adding Sub Menu Item to Current Custom Menu | Excel Programming | |||
Add item to sheet right-click menu? | Excel Programming | |||
Adding a menu item right click menu when clicking on a single. | Excel Programming |