cannot set range class?
Probably don't need all the form code but post enough for others to attempt
to reproduce what you have. Eg, that formula sting ends up pasted as 20 red
lines in the VBE, very tedious to sort out. Try ensuring each line is less
than 76 characters when posted to avoid wrapping. Give an example of the
address of MyRng2 and any sheet names, with a view to being able to return a
string formula to examine for problems.
Regards,
Peter T
"Steve" wrote in message
...
Howdee all.
I've made a user form to input a couple of worksheet functions, and have
run
across a problem that doesn't show up on other workbooks.
I get a runtime error message- 1004-- stating: Unable to set the
FormulaArray property of the Range class.
When I had this earlier today I'd found it was due to my not having set
the
.address() components of the range.
However, I'd fixed that, and it works on another workbook just fine.
I then set a message box to see what the equation was outputting, and all
I
got was a 'false.'
I.e.,
msgbox myrng3.formula = myformula2, vbokonly, "test"
I'm unable to find anything that'd keep it from working. I did notice that
it did not place the single quote mark around the worksheet name, as is
standard. I tried placing a chr(39) in there, and it threw yet another
error,
so I removed it.
The only difference I can identify is that the worksheet's name has a
number
on the end, where it's not working.
SheetA, as opposed to SheetA_081
Here's my formula, and set for the FormulaArray.
myFormula2 = "=IF(ROWS(" & MyRng3.Address(RowAbsolute:=True,
ColumnAbsolute:=True, _
external:=False) & ":" & MyRng3.Address(RowAbsolute:=False,
ColumnAbsolute:=True, _
external:=False) & ")" & MyRng2.Address(RowAbsolute:=False,
ColumnAbsolute:=True, _
external:=False) & "," & Chr(34) & "All Names Accounted For" & Chr(34) &
",INDEX(" _
& MyRng.Address(RowAbsolute:=True, ColumnAbsolute:=True, external:=True) &
_
",SMALL(IF(ISNA(MATCH(" & MyRng.Address(RowAbsolute:=True,
ColumnAbsolute:=True, external:=True) _
& "," & MyRngA.Address(RowAbsolute:=True, ColumnAbsolute:=True,
external:=False) & ",0)),ROW(" _
& MyRng.Address(RowAbsolute:=True, ColumnAbsolute:=True, external:=True) &
_
")),ROWS(" & MyRng3.Address(RowAbsolute:=True, ColumnAbsolute:=True,
external:=False) _
& ":" & MyRng3.Address(RowAbsolute:=False, ColumnAbsolute:=True,
external:=False) & _
"))-MIN(ROW(" & MyRng.Address(RowAbsolute:=True, ColumnAbsolute:=True,
external:=True) & "))+1))"
MyRng3.FormulaArray = myFormula2
If the rest of the form's code is needed, please let me know.
Thank you.
Best.
|