Hi i have a code below and i want manually selected rows all at once to delete however if i have the 1st msgbox then it just says no rows selected
VBA Code:
Sub deleterows()
Dim i As Long, irow As Long
Dim oSel As Range
Dim answer As String
Set oSel = Selection
If oSel.Areas.Count <= 0 Then 'if i delete this code of line then it just gives the msgbox to delete regrdless of not selected of any rows
MsgBox "rows not selected"
ElseIf oSel.Areas.Count <= 1 Then
answer = MsgBox("Would u like to delete?", vbQuestion + vbYesNo, "Confirm to delete")
If answer = vbYes Then
For i = oSel.Areas.Count To 1 Step -1
oSel.Areas(i).EntireRow.Delete xlUp
Next i
End If
End If
End Sub