View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Limit on Number of Lines of VBA Code?

Mark

I would guess it's available memory. I just added 10,000 lines to a module
with no problem.

Sub testlines()

Dim i As Long
Dim vbc As VBComponent
Dim vbp As VBProject
Dim wb As Workbook

Set wb = Workbooks.Add

Set vbc = wb.VBProject.VBComponents.Add(vbext_ct_StdModule)

For i = 1 To 10000
vbc.CodeModule.InsertLines 1, "'" & i
Next i

End Sub

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Mark D'Agosta" wrote in message
...
I know there are certain VBA limits that don't exist in the standard

Visual
Basic Development Environment (e.g. number of Line Continuation characters
in the same subroutine), but is there a limit to the number of lines of

VBA
code that can exist within a single Excel workbook??? I'm currently using
Excel 2002.

Thanks,

Mark D'Agosta