LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Macro in a endless loop

What I'm trying to do is to force a zero into cell c13 in a particular
worksheet.

I have two macro - the first is always running in the background - and the
second is called by the first. It doesn't seem to matter where I try to
force the zero into cell c13 it forces the macro into the loop.

Any help would be appreciated.

The following macro is always running
Sub Worksheet_Change(ByVal Target As Range)
'If Target.Address = Range("product").Address Then
If Range("product").Value = "" Then
shtInput.[button 17].Visible = False
Exit Sub
End If
'End If
If Range("product").Value = "Capital_Bonus_2" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = True
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False
shtInput.Protect
End If
If Range("product").Value = "Expanding_Horizon_5" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = True
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False
shtInput.Protect
End If
If Range("product").Value = "Expanding_Horizon_7" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = True
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False
shtInput.Protect
End If
If Range("product").Value = "GPA_5Yr" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = False
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False
If Range("RiskC").Value = "" Then
Exit Sub
End If
shtInput.Protect
End If
If Range("product").Value = "GPA_9Yr" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = False
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False
If Range("RiskC").Value = "" Then
Exit Sub
End If
shtInput.Protect
End If
If Range("product").Value = "Maximum_Solutions_II" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = False
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False

If Range("RiskC").Value = "" Then
Exit Sub
End If
shtInput.Protect
End If
If Range("product").Value = "GPA_Seminole_County" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = False
Range("GPeriod").Select
Selection.Locked = True
Range("SolvPrem").Select
Selection.Locked = False

If Range("RiskC").Value = "" Then
Exit Sub
End If
shtInput.Protect
End If
If Range("product").Value = "MY_Guaranteed_Solution_II" Then
shtInput.Unprotect
Range("RiskC").Select
Selection.Locked = True
Range("GPeriod").Select
Selection.Locked = False
Range("SolvPrem").Select
Selection.Locked = True
' shtInput.Range("c13") = 0

If Range("GPeriod").Value = "" Then
Exit Sub
End If
shtInput.Protect
End If
Module1.check_error
End Sub

The following macro is check_error
Sub check_error()
Dim sht As Worksheet
shtCB2D.Visible = False
shtCB2V.Visible = False
shtMAX2D.Visible = False
shtMAX2V.Visible = False
shtEH5D.Visible = False
shtEH5V.Visible = False
shtEH7D.Visible = False
shtEH7V.Visible = False
shtGPA5D.Visible = False
shtGPAV.Visible = False
shtGPA9D.Visible = False
shtGPAV.Visible = False
shtGPASC.Visible = False
shtGPAV.Visible = False
shtMYGSD.Visible = False
shtMYGSV.Visible = False
shtAgent.Visible = False
If Range("product").Value = "MY_Guaranteed_Solution_II" Then
' shtInput.Range("c13") = 0
End If
For Each sht In Worksheets
' sht.Visible = True
Next
If shtInpInfo.Range("valid").Value < 0 Then
shtInput.[button 17].Visible = False
Beep
End If

If shtInpInfo.Range("valid").Value = 0 Then
shtInput.[button 17].Visible = True
shtInput.[button 248].Visible = True
Select Case Range("product").Value
Case Is = "Capital_Bonus_2"
shtCB2D.Visible = True
shtCB2V.Visible = True
Case Is = "Maximum_Solutions_II"
shtMAX2D.Visible = True
shtMAX2V.Visible = True
Case Is = "Expanding_Horizon_5"
shtEH5D.Visible = True
shtEH5V.Visible = True
Case Is = "Expanding_Horizon_7"
shtEH7D.Visible = True
shtEH7V.Visible = True
Case Is = "GPA_5Yr"
shtGPA5D.Visible = True
shtGPAV.Visible = True
Case Is = "GPA_9Yr"
shtGPA9D.Visible = True
shtGPAV.Visible = True
Case Is = "GPA_Seminole_County"
shtGPASC.Visible = True
shtGPAV.Visible = True
Case Is = "MY_Guaranteed_Solution_II"
shtMYGSD.Visible = True
shtMYGSV.Visible = True
shtInput.[button 248].Visible = False
Case Else
MsgBox "Not a valid plan"
End Select
End If
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
endless loop - using input box [email protected] Excel Programming 2 February 8th 07 04:26 AM
Endless loop freddie mac Excel Programming 2 August 1st 06 03:19 PM
endless loop help John Excel Programming 1 October 26th 05 04:51 PM
Endless loop? John Excel Programming 24 August 2nd 05 06:41 PM
Interrupting an endless loop davegb Excel Programming 3 March 17th 05 05:06 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"