ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limit on Number of Lines of VBA Code? (https://www.excelbanter.com/excel-programming/282206-limit-number-lines-vba-code.html)

Mark D'Agosta

Limit on Number of Lines of VBA Code?
 
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




Dick Kusleika[_3_]

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







All times are GMT +1. The time now is 05:21 PM.

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