Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Procedure Too Large problems

I'm writing a procedure that adds entries from a userform to different
worksheets, based on the value in a combobox.

The first portion of the code is:

Private Sub cmdADD_Click()

' need to write a proc for each vendor to handle the ranges - ugh
'
Dim wks As Worksheet
Dim vendorstr As String
Dim shtname As String
Dim totalrows As Integer
Dim toprow
Dim newrow As Integer

If cbxVendorID.TextLength = 0 Then GoTo enderr01

shtname = "VCB" & cbxVendorID.Value

' 89 possible variants since 89 vendors

If cbxVendorID.Value = "ADOR" Then GoTo vADOR

Each add procedure to each wks is...

vADOR: With Range("rADOR")

toprow = .row
totalrows = .Rows.Count
newrow = toprow + totalrows

.Cells(newrow, 2) = txtClaimNbr.Value
.Cells(newrow, 3) = txtUnitSN.Value
.Cells(newrow, 4) = txtDOP.Value
.Cells(newrow, 5) = txtPartDescr.Value
.Cells(newrow, 6) = txtPartNbr.Value
.Cells(newrow, 7) = txtAppMod.Value
.Cells(newrow, 8) = txtAppSN.Value
.Cells(newrow, 10) = txtSquawk.Value
.Cells(newrow, 9) = txtVCBCN.Value
.Cells(newrow, 11) = txtPartCost.Value
.Cells(newrow, 12) = txtDlrMkup.Value
.Cells(newrow, 13) = txtLabor.Value
.Cells(newrow, 14) = txtFrt.Value
.Cells(newrow, 15) = txtTotal.Value

.Resize(.Rows.Count + 1).Name = "rADOR"

End With

GoTo end01

And repeat that for each of 89 vendors. When I compile it, I get the
Procedure Too Large error. Help sez "When compiled, the code for a
procedure can't exceed 64K. This error has the following cause and
solution:

Code for this procedure exceeds 64K when compiled.
Break this, and any other large procedures, into two or more smaller
procedures."

Any ideas on how to do this and get around the size limitation? I've
thought of eliminating the ranges, and of making all the
..cells(newrow, x) instructions in a separate label, but then I get an
Unqualified reference error.

Ideas?
The cmdADD_Click is fired from a single command button.
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
XY Scatter-problems with large data records DataGeek Excel Discussion (Misc queries) 1 May 28th 08 09:53 PM
=LARGE problems Adam Excel Discussion (Misc queries) 2 April 3rd 08 06:39 PM
VBA Compile error: Procedure too large? Jerry Dyben Excel Discussion (Misc queries) 1 October 31st 05 10:15 PM
Problems when printing large workbooks Jayne Excel Discussion (Misc queries) 0 March 8th 05 03:43 PM


All times are GMT +1. The time now is 12:05 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"