Entire Row Delete

stapuff

Well-known Member
Joined
Feb 19, 2004
Messages
1,126
I am looking to delete a row only if the row number is double clicked.

The following works, however, not specifically what I am looking for.

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
With Target.EntireRow.Delete
End With
End Sub


Any thoughts...

Thanks,

Kurt
 
Kurt

Do you mean the row number to the left of the actual sheet?

If so then I don't think there's any event associated with it.

What specifically do you want to do?

By the way the code posted is for the BeforeRightClick event.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.EntireRow.Delete
End Sub
 
Upvote 0
Maybe:

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If (Target.Count = 256 And Target.Rows.Count = 1) Then Target.EntireRow.Delete
End Sub
 
Upvote 0
Would this work for you?

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Application.EnableEvents = False
If Target.Columns.Count = 256 Then Target.EntireRow.Delete
Application.EnableEvents = True

End Sub

If you click the row number, the entire <strike>column</strike> row (not column, duh) is selected. So if the number of columns in the selection=256, delete the selected row(s).
 
Upvote 0
Von Pookie -

That was exactly what I wanted.

I appreciate everyone that took the time to look at the post and for those who gave suggestion my hat is off to you.

Thanks for your time and energy,

Kurt
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top