Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA FormualArray error

Hi, I have the following code in VBA, whereby the following Array formula is
used to create a day 13 workdays in advance into the InBy_Box field on a
form. However, i can't seem to get it working any ideas whats wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA FormualArray error

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Hi, I have the following code in VBA, whereby the following
Array formula is
used to create a day 13 workdays in advance into the InBy_Box
field on a
form. However, i can't seem to get it working any ideas whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA FormualArray error

Thanks, but now i get the following message "Please enter a valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Hi, I have the following code in VBA, whereby the following
Array formula is
used to create a day 13 workdays in advance into the InBy_Box
field on a
form. However, i can't seem to get it working any ideas whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA FormualArray error

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Thanks, but now i get the following message "Please enter a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Hi, I have the following code in VBA, whereby the following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA FormualArray error

Its a text box on a form, where you input the date which needs 13 working
days adding.

existing VBA is as follows, which i can't quite get to work

' auto-calculation of 13-days date: this only happens
' when a new allocation is being made.
Private Sub Referral_Box_Exit(ByVal Cancel As MSForms.ReturnBoolean)

On Error GoTo ErrorHandler

' don't guess the 13-day date for an amendment
If Worksheets(1).amend Then Exit Sub

' guess 13 day date!
InBy_Box.Text =
Evaluate("=Referral_Box.Text+IF(13=0,0,SIGN(13)*SM ALL(IF((WEEKDAY(Referral_Box.Text+SIGN(13)*(ROW(IN DIRECT(""1:""&ABS(13)*10))),2)<6)*ISNA(MATCH(Refer ral_Box.Text+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13) *10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")

Exit Sub

ErrorHandler:

Cancel = True
MsgBox Prompt:="Please enter a valid referral date.", title:="Invalid
referral date"

End Sub

Thanks for your help

"Chip Pearson" wrote:

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Thanks, but now i get the following message "Please enter a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Hi, I have the following code in VBA, whereby the following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA FormualArray error

You can't refer to a control on a UserForm directly in a formula.
Try something like

Dim S As String
S = "=" & Referral_Box.Text &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH("
& _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"sdg8481" wrote in message
...
Its a text box on a form, where you input the date which needs
13 working
days adding.

existing VBA is as follows, which i can't quite get to work

' auto-calculation of 13-days date: this only happens
' when a new allocation is being made.
Private Sub Referral_Box_Exit(ByVal Cancel As
MSForms.ReturnBoolean)

On Error GoTo ErrorHandler

' don't guess the 13-day date for an amendment
If Worksheets(1).amend Then Exit Sub

' guess 13 day date!
InBy_Box.Text =
Evaluate("=Referral_Box.Text+IF(13=0,0,SIGN(13)*SM ALL(IF((WEEKDAY(Referral_Box.Text+SIGN(13)*(ROW(IN DIRECT(""1:""&ABS(13)*10))),2)<6)*ISNA(MATCH(Refer ral_Box.Text+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13) *10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")

Exit Sub

ErrorHandler:

Cancel = True
MsgBox Prompt:="Please enter a valid referral date.",
title:="Invalid
referral date"

End Sub

Thanks for your help

"Chip Pearson" wrote:

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Thanks, but now i get the following message "Please enter a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in
message
...
Hi, I have the following code in VBA, whereby the
following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default VBA FormualArray error

Hi, again thanks for your help much appricated, however i've tried the
following and i just get a return of FALSE, sorry to be a pain but if you
haven't gathered i'm a novice to VBA.

' guess 13 day date!
Dim S As String
InBy_Box = S = "Referral_Box" & S &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)


"Chip Pearson" wrote:

You can't refer to a control on a UserForm directly in a formula.
Try something like

Dim S As String
S = "=" & Referral_Box.Text &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH("
& _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"sdg8481" wrote in message
...
Its a text box on a form, where you input the date which needs
13 working
days adding.

existing VBA is as follows, which i can't quite get to work

' auto-calculation of 13-days date: this only happens
' when a new allocation is being made.
Private Sub Referral_Box_Exit(ByVal Cancel As
MSForms.ReturnBoolean)

On Error GoTo ErrorHandler

' don't guess the 13-day date for an amendment
If Worksheets(1).amend Then Exit Sub

' guess 13 day date!
InBy_Box.Text =
Evaluate("=Referral_Box.Text+IF(13=0,0,SIGN(13)*SM ALL(IF((WEEKDAY(Referral_Box.Text+SIGN(13)*(ROW(IN DIRECT(""1:""&ABS(13)*10))),2)<6)*ISNA(MATCH(Refer ral_Box.Text+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13) *10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")

Exit Sub

ErrorHandler:

Cancel = True
MsgBox Prompt:="Please enter a valid referral date.",
title:="Invalid
referral date"

End Sub

Thanks for your help

"Chip Pearson" wrote:

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Thanks, but now i get the following message "Please enter a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in
message
...
Hi, I have the following code in VBA, whereby the
following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VBA FormualArray error

If you're getting a result of FALSE, that means you have an IF
statement lacking an 'else' result. Examine your formula closely
to determine which IF doesn't have and 'else'.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Hi, again thanks for your help much appricated, however i've
tried the
following and i just get a return of FALSE, sorry to be a pain
but if you
haven't gathered i'm a novice to VBA.

' guess 13 day date!
Dim S As String
InBy_Box = S = "Referral_Box" & S &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH("
& S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)


"Chip Pearson" wrote:

You can't refer to a control on a UserForm directly in a
formula.
Try something like

Dim S As String
S = "=" & Referral_Box.Text &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH("
& _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"sdg8481" wrote in message
...
Its a text box on a form, where you input the date which
needs
13 working
days adding.

existing VBA is as follows, which i can't quite get to work

' auto-calculation of 13-days date: this only happens
' when a new allocation is being made.
Private Sub Referral_Box_Exit(ByVal Cancel As
MSForms.ReturnBoolean)

On Error GoTo ErrorHandler

' don't guess the 13-day date for an amendment
If Worksheets(1).amend Then Exit Sub

' guess 13 day date!
InBy_Box.Text =
Evaluate("=Referral_Box.Text+IF(13=0,0,SIGN(13)*SM ALL(IF((WEEKDAY(Referral_Box.Text+SIGN(13)*(ROW(IN DIRECT(""1:""&ABS(13)*10))),2)<6)*ISNA(MATCH(Refer ral_Box.Text+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13) *10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")

Exit Sub

ErrorHandler:

Cancel = True
MsgBox Prompt:="Please enter a valid referral date.",
title:="Invalid
referral date"

End Sub

Thanks for your help

"Chip Pearson" wrote:

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in
message
...
Thanks, but now i get the following message "Please enter
a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a
cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in
message
...
Hi, I have the following code in VBA, whereby the
following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any
ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA FormualArray error

Assuming your formula is correct otherwise,

Dim S As String
S = InBy_Box.Text
S = S &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)

--
Regards,
Tom Ogilvy


"sdg8481" wrote in message
...
Hi, again thanks for your help much appricated, however i've tried the
following and i just get a return of FALSE, sorry to be a pain but if you
haven't gathered i'm a novice to VBA.

' guess 13 day date!
Dim S As String
InBy_Box = S = "Referral_Box" & S &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH(" & S &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)


"Chip Pearson" wrote:

You can't refer to a control on a UserForm directly in a formula.
Try something like

Dim S As String
S = "=" & Referral_Box.Text &
"+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDAY(" & _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),2)<6 )*ISNA(MATCH("
& _
Referral_Box.Text &
"+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))), 25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "
Debug.Print Evaluate(S)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"sdg8481" wrote in message
...
Its a text box on a form, where you input the date which needs
13 working
days adding.

existing VBA is as follows, which i can't quite get to work

' auto-calculation of 13-days date: this only happens
' when a new allocation is being made.
Private Sub Referral_Box_Exit(ByVal Cancel As
MSForms.ReturnBoolean)

On Error GoTo ErrorHandler

' don't guess the 13-day date for an amendment
If Worksheets(1).amend Then Exit Sub

' guess 13 day date!
InBy_Box.Text =
Evaluate("=Referral_Box.Text+IF(13=0,0,SIGN(13)*SM ALL(IF((WEEKDAY(Referral_Box.Text+SIGN(13)*(ROW(IN DIRECT(""1:""&ABS(13)*10))),2)<6)*ISNA(MATCH(Refer ral_Box.Text+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(13) *10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")

Exit Sub

ErrorHandler:

Cancel = True
MsgBox Prompt:="Please enter a valid referral date.",
title:="Invalid
referral date"

End Sub

Thanks for your help

"Chip Pearson" wrote:

What is Referral_Box? A named cell? Something else?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in message
...
Thanks, but now i get the following message "Please enter a
valid referral
date", any ideas

"Chip Pearson" wrote:

You use FormulaArray to assign an array formula to a cell.
Perhaps you need something like

InBy_Box.Text =
Evaluate("=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(I F((WEEKDAY(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1 :""&ABS(13)*10))),2)<6)*ISNA(MATCH(Referral_Box+SI GN(13)*(ROW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) ")



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"sdg8481" wrote in
message
...
Hi, I have the following code in VBA, whereby the
following
Array formula is
used to create a day 13 workdays in advance into the
InBy_Box
field on a
form. However, i can't seem to get it working any ideas
whats
wrong and how
to fix it.

Thanks

InBy_Box.Text = DataValue.FormulaArray =
"=Referral_Box+IF(13=0,0,SIGN(13)*SMALL(IF((WEEKDA Y(Referral_Box+SIGN(13)*(ROW(INDIRECT(""1:""&ABS(1 3)*10))),2)<6)*ISNA(MATCH(Referral_Box+SIGN(13)*(R OW(INDIRECT(""1:""&ABS(13)*10))),25/12/06,0)),ROW(INDIRECT(""1:""&ABS(13)*10))),ABS(13))) "











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
Error Handling - On Error GoTo doesn't trap error successfully David Excel Programming 9 February 16th 06 05:59 PM
Form Err.Raise error not trapped by entry procedure error handler [email protected] Excel Programming 1 February 8th 06 10:19 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Automation Error, Unknown Error. Error value - 440 Neo[_2_] Excel Programming 0 May 29th 04 05:26 AM


All times are GMT +1. The time now is 03:59 PM.

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

About Us

"It's about Microsoft Excel"