Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Compile Error: Proceedure too large

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
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
VBA Compile error: Procedure too large? Jerry Dyben Excel Discussion (Misc queries) 1 October 31st 05 10:15 PM
Compile error: Procedure too large BHARATH RAJAMANI Excel Programming 2 August 24th 05 10:24 PM
Compile Error: Procedure too Large Question Daniel R. Young Excel Programming 6 July 21st 05 08:01 PM
Compile error: Procedure too large Susan Hayes Excel Programming 2 May 20th 05 05:01 PM
Compile Error: Procedure too large mate Excel Programming 2 May 18th 04 04:30 PM


All times are GMT +1. The time now is 04:53 AM.

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

About Us

"It's about Microsoft Excel"