ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Program too large (https://www.excelbanter.com/excel-programming/379387-program-too-large.html)

[email protected]

Program too large
 
I am having a problem with a macro that I am writing. Everytime I try
to run it it gives me an error. I think I can fix it using global
variables. But now I keep getting an error saying invalid attribute. I
have tried setting all variables = 0 then running it. Please help!!!!


NickHK

Program too large
 
Give us more details on the error and when it happens.
AFAIK, there is limit of 64K (?) for the amount of code contained in a
single module, although I see no reason to ever get that large. Split it
into routines (sub/function) in modules/classes.
How large is your code ? Right-click on the moduleExport, save somewhere
suitable and check the size of the resultant file.

NickHK

wrote in message
ups.com...
I am having a problem with a macro that I am writing. Everytime I try
to run it it gives me an error. I think I can fix it using global
variables. But now I keep getting an error saying invalid attribute. I
have tried setting all variables = 0 then running it. Please help!!!!




Martin Fishlock

Program too large
 
You can try debugging your code and setting thru the program.

Some simple solutions are to use option explicit to check al lthe variables
are spelt correctly.

Generally attributes refer to incorrect items in function or procedure calls.

Check the line where your code breaks down and make sure the code is correct.

Do this with clicking debug and see where you are.


--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


" wrote:

I am having a problem with a macro that I am writing. Everytime I try
to run it it gives me an error. I think I can fix it using global
variables. But now I keep getting an error saying invalid attribute. I
have tried setting all variables = 0 then running it. Please help!!!!



NickHK

Program too large
 
And the error is where ?
As a text file, it is ~56K, all in one routine, but it looks like you need
to look at using arrays and process in a loop, then you would have a much
shorter routine.

Dim xData(1 to 36?) as long
'Then assign values

for i=1 to 36
....etc

NickHK

wrote in message
ups.com...
here is my code. I hope it isn't too large for this post.

Sub sort_WC()
Dim wscost As Worksheet
Dim wscostsort As Worksheet

Dim x As Long
Dim lrow1 As Long
Dim cnt As Long
Dim xjan04 As Long
Dim xfeb04 As Long
Dim xmar04 As Long
Dim xapr04 As Long
Dim xmay04 As Long
Dim xjun04 As Long
Dim xjul04 As Long
Dim xaug04 As Long

----------- CUT --------------



[email protected]

Program too large
 

I am getting the error when I run the macro. It says that the macro is
too large. The reason I am I am using so many variables is because I
want to keep the references to the lines after each sort so I can
create a graph on a new sheet. I don't know much about arrays but I
could try it if it will give me the same result.



All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com