Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Some syntax given to me has error handling but I've found that that
doesn't work in a situation where the user can choose to cancel. Cancelling while performing an operation just causes the process to loop back so, in essence, the user is forced to continue. Can an additional option for when a user hits cancel be added to this great script (courtesy of JulieD; thanks Julie! <g). The error part doesn't handle a cancel by the user. ------------------------------------------------------------------------------------------------ Sub insertrows() Dim i As Long Dim j As Long Dim k As Long On Error GoTo dontdothat Do i = InputBox("How many rows do you want to insert?", "Insert Rows", 1) Loop Until i < 0 Do j = InputBox("At what row number do you want to start the insertion?", "Insert Rows", 1) Loop Until j < 0 ActiveSheet.Unprotect k = j + i - 1 Range("" & j & ":" & k & "").Insert shift:=xlDown j = j - 1 Range("A" & j & "").Select Selection.AutoFill Destination:=Range("A" & j & ":A" & k & ""), Type:=xlFillDefault ActiveSheet.Protect Exit Sub dontdothat: Resume End Sub ------------------------------------------------------------------------------------------------ Thanks! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
correct syntax for nesting "if", "and", and "vlookup"....if possib | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
syntax for "IF" commend to check for multiple empty cells bf comma | Excel Worksheet Functions | |||
Syntax to "OR" 3 "ISERROR" conditions | Excel Worksheet Functions | |||
what is syntax for if(between range of dates,"Q1","Q2")? | Excel Worksheet Functions |