PC Review


Reply
Thread Tools Rate Thread

Compile Error: Proceedure too large

 
 
=?Utf-8?B?SVRfcm9vZmVy?=
Guest
Posts: n/a
 
      8th Aug 2007
I have a routine that calculates % Done of a 9-step userform-based program
and when I got done writing the code for it, I received this error. The code
routine is 2054 lines of code so posting code here wouldn't be a good idea.
But, the basic idea is that the code checks whether or not a checkbox has
been checked and if it has it check the next in line. If it's not, it will
skip it and check the next in line, etc. I'm terrible with loops of any kind,
so maybe someone could help me shorten up the routine?

Here's the first 100 (or so) lines:

Sub formupdater()
Dim i As String
i = 30
If start_here.step1.Value = True Then
If start_here.step2.Value = True Then
If start_here.step3.Value = True Then
If start_here.step4.Value = True Then
If start_here.step5.Value = True Then
If start_here.step6.Value = True Then
If start_here.step7.Value = True Then
If start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 9
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 9) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 8
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 8) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step9.Value = True Then
start_here.statfront.Width = i * 8
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 8) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 7) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 8
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 8) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 7) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step9.Value = True Then
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 7) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 6) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step7.Value = True Then
If start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 8
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 8) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 7) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step9.Value = True Then
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 7) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 6) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 7) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 6) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step9.Value = True Then
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status: " &
Int(((i * 6) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 5
start_here.StatusBar1.Panels(3).Text = "Status: " &
Int(((i * 5) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step6.Value = True Then
If start_here.step7.Value = True Then
If start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 8
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 8) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text =
"Status: " & Int(((i * 7) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step9.Value = True Then
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 7) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 6) / 270) * 100) & "% Complete"
End If
ElseIf start_here.step8.Value = True Then
If start_here.step9.Value = True Then
start_here.statfront.Width = i * 7
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 7) / 270) * 100) & "% Complete"
Else
start_here.statfront.Width = i * 6
start_here.StatusBar1.Panels(3).Text = "Status:
" & Int(((i * 6) / 270) * 100) & "% Complete"
End If


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile Error: Procedure too large Simon Microsoft Excel Programming 1 3rd Feb 2010 08:18 PM
Compile Error - Procedure too large DAVEYB Microsoft Excel Programming 7 1st Sep 2008 09:41 PM
Compile Error: Procedure too large Corey .... Microsoft Excel Programming 1 25th Jul 2008 09:53 AM
Compile Error - Procedure too large LB79 Microsoft Excel Misc 1 11th Aug 2004 06:08 PM
Compile Error: Procedure to Large Will Microsoft Access Reports 0 20th May 2004 07:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:11 PM.