Thread: Auto-Insert
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Auto-Insert

One of the following will do it. Note that it inserts a row under the row
that is double clicked.

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

Cancel = True 'Cancel Edit mode started by double click

ActiveCell.Offset(1, 0).EntireRow.Insert Shift:=xlDown

End Sub

The following is similar but will only run if you double click column A.

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

Cancel = True 'Cancel Edit mode started by double click

If Target.Column = 1 Then
ActiveCell.Offset(1, 0).EntireRow.Insert Shift:=xlDown
End If

End Sub


--
Regards,

OssieMac


"kirkm" wrote:

Could anyone help with some VB code to do the following,

After double clicking a cell in say Row 17, a new row 18 is inserted.

Thanks - Kirk