LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Troy
 
Posts: n/a
Default FormulaArray

Hi!

I have the following code which inserts formula in multiple cells:

RC=RowColumn LC=LastColumn SC=StartColumn

myformula = "= SUM(IF(LEN(R" & RC & "C" & SC & ":R" & RC & "C" & LC &
")=1,IF(LEFT(R" & RC & "C" & SC & ":R" & RC & "C" & LC & ")=" & """" &
Mid(MyText, Counter - 6, 1) & """" & ",8.5,0),0)) + SUM(IF(R" & RC & "C" &
SC & ":R" & RC & "C" & LC & "=" & """" & Mid(MyText, Counter - 6, 1) & "!"""
& ",8,0))" & " & " & """ / """ & " & " & "SUM(IF(LEN(R" & RC & "C" & SC &
":R" & RC & "C" & LC & "1 ),IF(LEFT(R" & RC & "C" & SC & ":R" & RC & "C" &
LC & ") =" & """" & Mid(MyText, Counter - 6, 1) & """" &
",IF(ISNUMBER(VALUE(MID(R" & RC & "C" & SC & ":R" & RC & "C" & LC &
",2,LEN(R" & RC & "C" & SC & ":R" & RC & "C" & LC & ")-1))),VALUE(MID(R" &
RC & "C" & SC & ":R" & RC & "C" & LC & ",2,LEN(R" & RC & "C" & SC & ":R" &
RC & "C" & LC & ")-1)),0),0)))"

I can insert it OK with the following and manually change it to an Array
Formula:

Range(Cells(RC, LC + Counter), Cells(RC, LC + Counter)).Formula = myformula

However when I use the following I get an error message:
"Runtime error 1004" "Unable to set the FormulaArray property of the Range
class."

Range(Cells(RC, LC + Counter), Cells(RC, LC + Counter)).FormulaArray =
myformula

Any help appreciated

Troy


 
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



All times are GMT +1. The time now is 04:11 AM.

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"