Re: Length limitation of cell formulas
- From: "Peter T" <peter_t@discussions>
- Date: Wed, 20 Apr 2005 15:26:20 +0100
This contrives to build a formula length of 5489:
Sub test()
Dim i As Long, nShts As Long
Dim sF As String, sPartF As String
Dim sName As String, sMsg As String
Dim cel As Range
sName = "z"
Worksheets(2).Name = sName
Worksheets(2).[a1:a200].Value = 1
sPartF = sName & "!A"
sF = "=" & sPartF & 1
nShts = 161
For i = 2 To nShts
sF = sF & "+" & sPartF & i
Next
Set cel = Worksheets(1).[a1]
cel.Formula = sF
sName = "My_Unnecessarily_Long_SheetName"
Worksheets(2).Name = sName
sMsg = nShts & " additions" & vbCr & _
"Original formula len " & Len(sF) & vbCr & _
"Actual formula len " & (Len(sName) - 1) * nShts + Len(sF) & vbCr & _
"Readable formula len " & Len(cel.Formula)
MsgBox sMsg, , "Value A1 = " & cel.Value
End Sub
Regards,
Peter T
"Peter T" wrote:
> Hi Paul,
>
> As others have said the length limit for a formula applied with vba is max
> 1024, or can be a bit less.
>
> However you may be able to work around this. Eg, if the formula contains
> references to other ***(s) you can rename ***(s) to something very
> short, build your formula string with short names, apply the formula, then
> restore original long *** name(s).
>
> I don't know the "real" max length of a formula, as a guess 32k. Even
though
> the formula could be considerably more than 1024, you cannot "read" more
> than the first 1000+ characters.
>
> Regards,
> Peter T
>
>
> "Paul O. Schenker" <paul.schenker@xxxxxxxxxx> wrote in message
> news:42664539$1_3@xxxxxxxxxxxxxxxxxx
> > Hi all,
> >
> > is there a length limitation for formulas?
> >
> > Thanks for any reply.
> >
> > Paul
> >
> >
>
>
.
- Follow-Ups:
- Re: Length limitation of cell formulas
- From: Peter T
- Re: Length limitation of cell formulas
- References:
- Length limitation of cell formulas
- From: Paul O. Schenker
- Re: Length limitation of cell formulas
- From: Peter T
- Length limitation of cell formulas
- Prev by Date: Date Modified from an External Internet Source
- Next by Date: Re: Referencing .Net DLLs
- Previous by thread: Re: Length limitation of cell formulas
- Next by thread: Re: Length limitation of cell formulas
- Index(es):
Loading