what's maximum number of line continuations in a vba code

kylefoley76

Well-known Member
Joined
Mar 1, 2010
Messages
1,553
anyone know this. i've got 1200 line continuations and excel and word are saying that that's too much. excel 2007
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Are you trying to get that into a single cell in Excel? Maybe you have more than the maximum number of characters in a cell (32,767) and are thus getting data truncated?
 
Upvote 0
no, i'm writing it in vba editor. i have an array with about 1200 items. i saw on one blog that even 25 lines is too much. that will be too time consuming. let me post the vba code and you can suggest what i do.
 
Upvote 0
Why are you hard-coding an array of so many items?

What are the items?

Are they totally unique?

Could they possibly be generated via code?

Or perhaps you could try storing them somewhere? eg worksheet, text file, outer space.
 
Upvote 0
ok, here is the basic macro i'm using. i've identified 1200 unique word combinations that will indicate a german noun's gender. in this array there are only 3 items, but in the ideal array there will be 1200

here is what it looks like

https://docs.google.com/document/pub?id=1t6tYt_LfprKyYfN9SG0AoTn6SM2wyjEdLREn6Ki2sxc

but it's not working. i think i'm just going to have to divide it up into 10 sections but if you know of a different way then please let me know.

findArray = array(" mit der "," mit den "," mit dem ")
replArray = array(" mitder"," mitden"," mitdem")

for i =0 to ubound(findArray)
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = findArray(i)
.Replacement.Text = replArray(i)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
next i
 
Upvote 0
Kyle

Do my spectacles decieve me? Or is that Word code?
 
Upvote 0
That code won't work in Excel unless you are automating Word.

There is no Find.Execute method in Excel VBA and vbReplaceAll is a Word VBA constant.

There is a line continuation limit - 25 apparently.

Help suggests you make the lines longer, eg have more than 1 item on each line.

I would recommend you find another way to load this array, or perhaps consider another approach that doesn't involve an array.
 
Upvote 0
for the moment, i'm dividing it into 10 sections. but i still find that very short-sighted on microsoft's part that they couldn't forsee someone needing more than 25 line continuations. if they can allow for 1 million records in excel then surely they can allow for more line continuations in vba
 
Upvote 0

Forum statistics

Threads
1,225,516
Messages
6,185,439
Members
453,289
Latest member
ALPOINT_AIG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top