Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with VB code
Im not an expert in VB codes so please be patient I have a Worksheet of two stages to enter measures and calculate a result. Depending in the result obtained on Stage 1 a second Stage must be performed so I created a VB code to open a UserForm (that contains two commandButtons) that allows me to enter the measures of the Stage 2 when the results of the Stage 1 does not meet the acceptance range. I have a AND function in cell Q27 that if both acceptance range are meets in the Stage1 then Q27 = True, if no Q27= False. When Q27=False the UserForm is showed and one of the commandButtons allows me to continue enter data on the Stage2 but each time that I enter a number on the Stage 2 cells the Userform is open again. I know that is caused by a loop of the If Then statement but I have no idea how to €śbreak€ť the loop and open the UserForm only one time. Private Sub Worksheet_Calculate() Set Target = Range("Q27") If Target.Value = "True" Then Label1.Visible = True Else Label1.Visible = False Label2.Visible = True End If UserForm5.Show Worksheets("Sheet1").Unprotect Password:="password" Set Target = Range("S15") If Target.Value = "2" Then Range("J28").NumberFormat = "0.0%" Worksheets("Sheet1").Protect Password:="password" Else Worksheets("Sheet1").Unprotect Password:="password" Range("J28").NumberFormat = "0%" Worksheets("Sheet1").Protect Password:="password" End If End Sub I will, appreciate any help from you Thanks€¦€¦ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating excel file, adding code to it from code, VBE window stays | Excel Programming | |||
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? | Excel Programming | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |