dannyok90
Board Regular
- Joined
- Aug 30, 2016
- Messages
- 115
Hi All,
Racking my brain a little.. got some code below that deletes a row using a button..
the delete row button is at the begining of the row in column a. The code deletes the row fine
but not the button? the button just goes really small.. how could i get the command to delete the
entire row and any buttons in it?
Thanks,
Dan
Racking my brain a little.. got some code below that deletes a row using a button..
the delete row button is at the begining of the row in column a. The code deletes the row fine
but not the button? the button just goes really small.. how could i get the command to delete the
entire row and any buttons in it?
Thanks,
Dan
Code:
Option Explicit
Sub deletebutton()
Dim rng As Range
Dim rngOld As Range
Dim msgRes As VbMsgBoxResult
Set rngOld = ActiveCell
Set rng = ActiveSheet.Shapes(Application.Caller).TopLeftCell.EntireRow
rng.Select
msgRes = MsgBox("Proceed?", vbOKCancel, "About to Delete this row.")
If msgRes = vbOK Then
Sheet1.Unprotect Password:="xyz"
rng.Delete
Sheet1.Protect Password:="xyz"
End If
rngOld.Select
End Sub