PDA

View Full Version : Length of VBA line



constamj
12-02-2008, 09:39 AM
I have a line in one of my codes that I believe is to long. When I run the macro it places #VALUE! in the cell. It is 403 charaters long. What can I do to fix this.

Oorang
12-02-2008, 10:13 AM
403 is not near any limit of recent excel or VBA so unless you are using a very old version this is probably not what is going on. Perhaps you could post the code and we can take a look?

constamj
12-02-2008, 11:01 AM
This is all on one line.

.Range("I39").Value = .Evaluate("AVERAGE(IF(A1:A" & LastRow & "={""10639"",""10825"",""10828"",""10834"",""10835"",""11830"",""11831"",""12105"",""12106"",""12309"",""12310"",""12311"",""12312"",""12318"",""12319"",""12417"",""14637"",""14638"",""14820"",""14821"",""14822"",""14823"",""14824"",""14826"",""14827"",""14829"",""10833"",""10832"",""120C1"",""120C2"",""120C3"",""120C4""},E1:E" & LastRow & "))")

Oorang
12-02-2008, 02:17 PM
Ahh:) The problem here is just that the formula itself is invalid. What were you trying to accomplish? (And also what object was this line "With"ed to?)

constamj
12-03-2008, 05:16 AM
Its within a with statment, and I am trying to average certain numbers in an excel sheet. Those that are in that line is about half. I want it to find those numbers then look at E1:E and average the corresponding number in that row. I have other formulas that look just like that one but have like 3 or 4 less numbers to find.

constamj
12-04-2008, 09:03 AM
If i take out one of my numbers then it works... but thats not what i want. I was also trying to find an average between 2 dates, same type of thing but with dates and not numbers.

What do you mean by invalid.