I currently have the code below written to allow a custom button on the right click menu. This was written to allow a user to cut and paste a row to a designated spot within a protected sheet. My question is, how do I get this code to allow the user to highlight multiple rows so they can cut and past a group of rows at the same time???
Code:
Public Sub cutProtectedRow()
Application.EnableCancelKey = xlDisabled
Dim ws As Worksheet
On Error Resume Next
Set ws = ActiveWorkbook.Sheets("LookAhead Schedule")
On Error GoTo 0
If ws Is Nothing Then
MsgBox "Function Only Works in LookAhead Sheet!!!"
Else
If ws.Name = ActiveWorkbook.ActiveSheet.Name Then
ActiveSheet.Unprotect "password"
Rows(ActiveCell.row).Select
Selection.Cut
'userbox to request location of the isert of cut rows
Dim row
row = InputBox("enter Row Number to insert row below")
If Not row = vbNullString Then
ActiveSheet.Range("A" & row + 1).EntireRow.Insert
End If
'reprotect sheet
ActiveSheet.Protect _
Password:="Password", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True, _
AllowFiltering:=True
Else
MsgBox "Function Only Works in LookAhead Sheet!!!"
End If
End If
Application.EnableCancelKey = xlInterrupt
End Sub