T
Tonso
I have recorded, then modified, the following macro, which unprotects the
sheet, aks if you are sure you want to delete the row, deletes the current
row, copies down a cell in column A that numbers the row, and protects the
sheet. Works fine, but if the user wants to delete not only the current row,
but multiple rows below it also, the macro must be repeated. How can I
accomplish deleting multiple rows, as indicated by the user? For example,
rows 18 thru 20, or 29 thru 33, etc, or of course, just the current row,
with the message box prompting the user for the number of rows to delete.
Thanks
ActiveSheet.Unprotect Password:="slikto"
Answer = MsgBox("Are you sure you want to delete?", vbYesNo)
If Answer <> vbYes Then Exit Sub
Application.ScreenUpdating = False
ActiveCell.Rows("1:1") .EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
Selection.Filldown
Application.ScreenUpdating = True
ActiveSheet.Protect Password:="slikto"
End Sub
sheet, aks if you are sure you want to delete the row, deletes the current
row, copies down a cell in column A that numbers the row, and protects the
sheet. Works fine, but if the user wants to delete not only the current row,
but multiple rows below it also, the macro must be repeated. How can I
accomplish deleting multiple rows, as indicated by the user? For example,
rows 18 thru 20, or 29 thru 33, etc, or of course, just the current row,
with the message box prompting the user for the number of rows to delete.
Thanks
ActiveSheet.Unprotect Password:="slikto"
Answer = MsgBox("Are you sure you want to delete?", vbYesNo)
If Answer <> vbYes Then Exit Sub
Application.ScreenUpdating = False
ActiveCell.Rows("1:1") .EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveCell.Select
Selection.Filldown
Application.ScreenUpdating = True
ActiveSheet.Protect Password:="slikto"
End Sub