VBA insert and delete row advice (1 Viewer)

Trebby

Registered User.
Local time
Today, 22:03
Joined
Apr 18, 2015
Messages
10
Hi All,

I have found a nice little code that allows me to insert a row when double clicking on a cell, copying contents as well. I was wondering if I could change it so it inserts a row if you click on the cell value '+' and deletes a row if you click on the value '-'? allowing me to insert and delete rows when needed.

Code:
Private Sub Worksheet_beforedoubleclick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    Target.Offset(1).EntireRow.Insert
    Target.EntireRow.Copy Target.Offset(1).EntireRow
    On Error Resume Next
    Target.Offset(1).EntireRow.SpecialCells (xlConstants)
End Sub

Second question (I have no idea how this would work), how would I copy a range of rows (including contents) and insert them to the bottom of a section? Again using the same logic above but value 'I' Insert and 'D' to delete.

Thank you
 

Ranman256

Well-known member
Local time
Today, 17:03
Joined
Apr 9, 2015
Messages
4,339
you dont need code,
you just type into the record slot at the bottom to insert a record.
 

GinaWhipp

AWF VIP
Local time
Today, 17:03
Joined
Jun 21, 2011
Messages
5,900
Hmm, code above looks to be for Excel but you posted in the Access section. So for which program are you asking?
 

Users who are viewing this thread

Top Bottom