Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
LT LT is offline
external usenet poster
 
Posts: 25
Default Wierd VBA happenings...

Hello all.

I was wondering if by chance there is a limit to how much code you can
type into a vba Excel document. Is there a limit on how much code can
go into one button or an entire userform?

I ask this cause I get this error message;

"Compile Error:
Only comments may appear after End Sub, End Function or End Property"

When it jumps me to see what's "wrong" it goes to highlight this line
of code that is in the middle of a bunch of code.

txtApt.Locked = True

Which, to my knowledge has nothing to do with why the errors that are
being generated.

I'm hoping one of you out there might have some knowledge to share on
any quirks with Excel and VBA.

Thanks in advance.

-LT

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Wierd VBA happenings...

A general rule of thumb is that each module can contain a maximum of about 64k
characters. If you copy and paste into Notepad and save that file as *.txt, you
can look at the size in windows explorer.

But are you sure you don't have an End Sub or End Function right before this
problem line?

Remember to scroll all the way to the right to check.

LT wrote:

Hello all.

I was wondering if by chance there is a limit to how much code you can
type into a vba Excel document. Is there a limit on how much code can
go into one button or an entire userform?

I ask this cause I get this error message;

"Compile Error:
Only comments may appear after End Sub, End Function or End Property"

When it jumps me to see what's "wrong" it goes to highlight this line
of code that is in the middle of a bunch of code.

txtApt.Locked = True

Which, to my knowledge has nothing to do with why the errors that are
being generated.

I'm hoping one of you out there might have some knowledge to share on
any quirks with Excel and VBA.

Thanks in advance.

-LT


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
LT LT is offline
external usenet poster
 
Posts: 25
Default Wierd VBA happenings...

On Mar 14, 3:48 pm, Dave Peterson wrote:
A general rule of thumb is that each module can contain a maximum of about 64k
characters. If you copy and paste into Notepad and save that file as *.txt, you
can look at the size in windows explorer.

But are you sure you don't have an End Sub or End Function right before this
problem line?

Remember to scroll all the way to the right to check.





LT wrote:

Hello all.


I was wondering if by chance there is a limit to how much code you can
type into a vba Excel document. Is there a limit on how much code can
go into one button or an entire userform?


I ask this cause I get this error message;


"Compile Error:
Only comments may appear after End Sub, End Function or End Property"


When it jumps me to see what's "wrong" it goes to highlight this line
of code that is in the middle of a bunch of code.


txtApt.Locked = True


Which, to my knowledge has nothing to do with why the errors that are
being generated.


I'm hoping one of you out there might have some knowledge to share on
any quirks with Excel and VBA.


Thanks in advance.


-LT


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thanks for the lead on the size information, I didn't know that one.
After doing as you suggested, all the code is stored on one userform
and it adds up to 75.4 kb. A few years back I had similiar Excel VBA
"weirdness" and attributed it to my lack of knowledge (I was just
learning it then) and now I think it is possibly due to the size of
all the code cause the module I had back then too had lots of code. I
guess that's another example of what For Each and loop uses can be
good for.

While I had it in the text doc, I utilized the Word Wrap feature to
see if there were any other End Sub's or such out of place or out of
sync, and nadda.

Going back to the size limits, I take it all the code on a userform
has similar limitations to a module?

Thanks again for your advice and help all.

-LT



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Wierd VBA happenings...

I would guess that all modules suffer from the approximate 64k restriction. But
I've never approached that in a userform/worksheet/thisworkbook/class module.

(I have had trouble in a General module--before I got dangerous!)

LT wrote:

On Mar 14, 3:48 pm, Dave Peterson wrote:
A general rule of thumb is that each module can contain a maximum of about 64k
characters. If you copy and paste into Notepad and save that file as *.txt, you
can look at the size in windows explorer.

But are you sure you don't have an End Sub or End Function right before this
problem line?

Remember to scroll all the way to the right to check.





LT wrote:

Hello all.


I was wondering if by chance there is a limit to how much code you can
type into a vba Excel document. Is there a limit on how much code can
go into one button or an entire userform?


I ask this cause I get this error message;


"Compile Error:
Only comments may appear after End Sub, End Function or End Property"


When it jumps me to see what's "wrong" it goes to highlight this line
of code that is in the middle of a bunch of code.


txtApt.Locked = True


Which, to my knowledge has nothing to do with why the errors that are
being generated.


I'm hoping one of you out there might have some knowledge to share on
any quirks with Excel and VBA.


Thanks in advance.


-LT


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thanks for the lead on the size information, I didn't know that one.
After doing as you suggested, all the code is stored on one userform
and it adds up to 75.4 kb. A few years back I had similiar Excel VBA
"weirdness" and attributed it to my lack of knowledge (I was just
learning it then) and now I think it is possibly due to the size of
all the code cause the module I had back then too had lots of code. I
guess that's another example of what For Each and loop uses can be
good for.

While I had it in the text doc, I utilized the Word Wrap feature to
see if there were any other End Sub's or such out of place or out of
sync, and nadda.

Going back to the size limits, I take it all the code on a userform
has similar limitations to a module?

Thanks again for your advice and help all.

-LT


--

Dave Peterson
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
Strange Happenings Alan Excel Discussion (Misc queries) 7 June 20th 06 09:15 PM
WIERD Excel Problem BK Setting up and Configuration of Excel 8 April 7th 06 01:17 AM
Wierd Copy and Paste BillCPA Excel Discussion (Misc queries) 3 April 4th 06 07:34 PM
Wierd event Freddie Excel Discussion (Misc queries) 0 March 17th 06 03:49 PM
Wierd XL Behavior revwhop Excel Discussion (Misc queries) 1 March 13th 06 03:34 PM


All times are GMT +1. The time now is 02:37 AM.

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

About Us

"It's about Microsoft Excel"