Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Everyone,
I'd like to thank everyone for their contribution to this group. I've found many answers and direction to work out problems with my macros. I'm always searcing this group before I post a question. This time one of thoes times I'm unable to find an answer. Here's the situation I have an input box that when the data entered is false the box pops back up seeking more input. What I need is when the loop is finished and there are no more sheets matching the data entered I just need the box to close. Here is the code. Private Sub CommandButton1_Click() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim sh As Variant Dim WS As Excel.Worksheet 'Next section adjusts HTML pages saved from RI 'To run this selection on multi sheets a Wild Card can be used Do Until sh = "False" sh = Application.InputBox( _ Prompt:="Please enter name of Worksheet to be formatted", _ Title:="Worksheet Name", _ Default:="*PO's", Type:=2) If sh = "False" Then Exit Sub 'User Cancelled For Each WS In Worksheets If WS.Name Like sh Then WS.Select Rows(2).Copy _ Destination:=Rows(1) Rows(1).HorizontalAlignment = xlCenter Rows(1).Select Selection.Font.Bold = True Rows("2:3").Delete 'Column Adjustments and Filter set Columns("A:F").Select Selection.EntireColumn.AutoFit Selection.AutoFilter Range("E:F").EntireColumn.Insert Range("G:G").Select Selection.NumberFormat = "#,#" Range("H:H").Select Selection.NumberFormat = "$#,#" Else: End If Next WS Loop Application.ScreenUpdating = True End Sub Many thanks for any help, advice and constructive criticism given, I'm still learning VBA, so any help is appreciated. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Remove the quotes around False
Since you're exiting the sub if the user cancels, there's no need for the Until sh = ... after Do, either. In article . com, Tsunami3169 wrote: If sh = "False" Then Exit Sub 'User Cancelled |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 8, 10:23 am, JE McGimpsey wrote:
Remove the quotes around False Since you're exiting the sub if the user cancels, there's no need for the Until sh = ... after Do, either. In article . com, Tsunami3169 wrote: If sh = "False" Then Exit Sub 'User Cancelled- Hide quoted text - - Show quoted text - Thanks tons. It works perfect now. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
input in number form is being multiplied by 1000 when i input. | Excel Discussion (Misc queries) | |||
Calculate true/false value based on array text input | Excel Worksheet Functions | |||
Error trying to close down dbase IV file used for input to excel | Excel Programming | |||
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF | Excel Worksheet Functions | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming |