View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
OkieViking OkieViking is offline
external usenet poster
 
Posts: 37
Default My equation is too long!

Fredrik,

I can type it into the spreadsheet. However, I want a macro to enter it
into the spreadsheet.

Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & "),'DIMS Data (2)'
!R1C6:R6992C[3]))"

works in VBA. However the line below doesn't. It gets error messages.

Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


"Fredrik Wahlgren" wrote:


"OkieViking" wrote in message
...
I am populating a table with equations. However, some of them are too

long.
I can type them in manually (and they work), so I know the equation is OK.
What can I do?


Selection.FormulaArray = _
"=SUM(IF(('DIMS Data (2)'!R1C1:R6992C[-2]=""MAG DEV TLP RIG
MOB"")*('DIMS Data (2)'!R1C8:R6992C[5]=" & PN & ")*('DIMS Data
(2)'!$I$1:$I$6992='RISER'),'DIMS Data (2)'!R1C6:R6992C[3]))"


That is only two lines of code


I don't understand. If you can enter the formula manually, how can it be too
long?
/Fredrik