Private Sub cmdDeleterow_Click()
Dim ra As Range
Dim ansrange1 As Integer
On Error GoTo handler
Set ra = Application.InputBox(Prompt:="Pick a cell.", Type:=8)
ansrange1 = ra.Row
If ra.Rows.count = 1 Then
If Right(ra.Row, 1) <> 3 Then
MsgBox "You can only choose the row end with 3! For example:23,33 and so on.", vbCritical, "Wrong"
Else
Range(ansrange1 & ":" & ansrange1 + 9).Delete Shift:=xlUp
For n = 2 To 6 Step 2
Cells(15993, n).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Shapes"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Not Allowed"
.InputMessage = ""
.ErrorMessage = "You are not allowed to change the data."
.ShowInput = True
.ShowError = True
End With
Next n
For j = 15993 To (15993 + 9)
Cells(j, 7).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Managers"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Not Allowed"
.InputMessage = ""
.ErrorMessage = "You are not allowed to change the data."
.ShowInput = True
.ShowError = True
End With
Next j
For k = 15993 To (15993 + 9)
Cells(k, 8).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Symbolss"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Not Allowed"
.InputMessage = ""
.ErrorMessage = "You are not allowed to change the data."
.ShowInput = True
.ShowError = True
End With
Next k
For rr = 1 To 9
For l = 15993 To (15993 + 9)
Cells(l, rr).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Next l
Next rr
For m = 1 To 9
q = 15993 + 9
Cells(q, m).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Next m
ss = 15993 - 1
For t = 1 To 9
Cells(ss, t).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
Next t
End If
Else
MsgBox "You picked more than one row!!", vbCritical, "Wrong"
End If
handler:
End Sub