Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to use an InputBox method to ask the user for a range of rows.
It works most of the time, but sometimes returns nothing, even though a range was chosen. It is also inconsistent - sometimes a chosen range is recognized, and sometimes the same range is not recognized. What gives? (Excel 2000 on Windows XP) Sub Delete_Rows() Dim Target As Range Dim SpecialRows() As Integer Dim i As Integer Dim BadRowsList As String Dim CancelDel As Boolean Dim EndCleared As Range CancelDel = False On Error Resume Next Title = " " Prompt = "Select row (or range of rows) to be deleted." Set Target = Application.InputBox( _ Prompt:=Prompt, _ Title:=Title, _ Default:=ActiveCell.Address, _ Type:=8) If Target Is Nothing Then Exit Sub Else Application.ScreenUpdating = False ReDim SpecialRows(Target.Rows.Count - 1) As Integer i = 0 Worksheets(1).Unprotect ("support") For Each rw In Target.Rows If rw.Row < 7 Then SpecialRows(i) = rw.Row i = i CancelDel = True End If Next If CancelDel = True Then MsgBox "Rows 1 - 6 cannot be deleted." Else Target.EntireRow.Delete End If Worksheets(1).Protect ("support") End If Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Trouble Using InputBox Method to Select Range from Other Sheets | Excel Programming | |||
Selecting a Range using Inputbox Method | Excel Programming | |||
Error 424 with inputbox method after OK | Excel Programming | |||
Using Arrays in InputBox Method | Excel Programming | |||
Inputbox method using type:=8 - How to Cancel? | Excel Programming |