Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Macro line too long?

I went to program this formula in my macro, it did not work. I am thinking
that it is too long to accept it. I even did it manually while the macro was
recording and it didn't record anything. Wonder why? The actual formula
does work, but want it to work in my macro.

Please help.
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX('[Charge Type
Translation.xls]Sheet1'!R2C1:R24C1,MAX(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge Type
Translation.xls]Sheet1'!R1C2))"

MrRJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro line too long?


Assuming your formula works, you just haven't broken it up correctly:
ActiveCell.FormulaR1C1 =
"=IF(ISERROR(RC[-1]),RC[2],INDEX" _
& "('[Charge Type Translation.xls]Sheet1'!R2C1:R24C1,MAX" _
& "(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW" _
& "('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge
Type Translation.xls]Sheet1'!R1C2))"

MrRJ;236034 Wrote:
I went to program this formula in my macro, it did not work. I am
thinking
that it is too long to accept it. I even did it manually while the
macro was
recording and it didn't record anything. Wonder why? The actual formula
does work, but want it to work in my macro.

Please help.
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX('[Charge Type
Translation.xls]Sheet1'!R2C1:R24C1,MAX(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge Type
Translation.xls]Sheet1'!R1C2))"

MrRJ



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=65874

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Macro line too long?

Hi Simon,
I am still have problems. Not sure why?
Range("P2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX" _
& "('[Charge Type Translation.xls]Sheet1'!R2C1:R24C1,MAX" _
& "(INDEX(('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW" _
& "('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge
Type Translation.xls]Sheet1'!R1C2))"
Range("P2").Select

"Simon Lloyd" wrote:


Assuming your formula works, you just haven't broken it up correctly:
ActiveCell.FormulaR1C1 =
"=IF(ISERROR(RC[-1]),RC[2],INDEX" _
& "('[Charge Type Translation.xls]Sheet1'!R2C1:R24C1,MAX" _
& "(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW" _
& "('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge
Type Translation.xls]Sheet1'!R1C2))"

MrRJ;236034 Wrote:
I went to program this formula in my macro, it did not work. I am
thinking
that it is too long to accept it. I even did it manually while the
macro was
recording and it didn't record anything. Wonder why? The actual formula
does work, but want it to work in my macro.

Please help.
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX('[Charge Type
Translation.xls]Sheet1'!R2C1:R24C1,MAX(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge Type
Translation.xls]Sheet1'!R1C2))"

MrRJ



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=65874


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro line too long?


What error are you getting?

MrRJ;236111 Wrote:
Hi Simon,
I am still have problems. Not sure why?

Code:
--------------------

Range("P2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX" _
& "('[Charge Type Translation.xls]Sheet1'!R2C1:R24C1,MAX" _
& "(INDEX(('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW" _
& "('[Charge Type Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge
Type Translation.xls]Sheet1'!R1C2))"
Range("P2").Select

--------------------


"Simon Lloyd" wrote:


Assuming your formula works, you just haven't broken it up

correctly:
ActiveCell.FormulaR1C1 =
"=IF(ISERROR(RC[-1]),RC[2],INDEX" _
& "('[Charge Type Translation.xls]Sheet1'!R2C1:R24C1,MAX" _
& "(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW" _
& "('[Charge Type

Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge
Type Translation.xls]Sheet1'!R1C2))"

MrRJ;236034 Wrote:
I went to program this formula in my macro, it did not work. I am
thinking
that it is too long to accept it. I even did it manually while

the
macro was
recording and it didn't record anything. Wonder why? The actual

formula
does work, but want it to work in my macro.

Please help.
ActiveCell.FormulaR1C1 = _
"=IF(ISERROR(RC[-1]),RC[2],INDEX('[Charge Type
Translation.xls]Sheet1'!R2C1:R24C1,MAX(INDEX(('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27=RC[3])*ROW('[Charge Type
Translation.xls]Sheet1'!R2C2:R24C27),))-ROW('[Charge Type
Translation.xls]Sheet1'!R1C2))"

MrRJ



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' ('The Code Cage' (http://www.thecodecage.com))

------------------------------------------------------------------------
Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon

Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
View this thread: 'Macro line too long? - The Code Cage Forums'

(http://www.thecodecage.com/forumz/sh...ad.php?t=65874)




--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=65874

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
Excel - How do I fit 2 lines of text in one cell, vs a long line? Ruthie Excel Discussion (Misc queries) 4 June 8th 07 03:17 PM
Breaking up long line of code doesn't work Hector Fernandez Excel Programming 13 December 18th 06 03:00 PM
one VERY LONG line moussant Excel Discussion (Misc queries) 7 November 11th 06 02:36 PM
How do I get the text to continue on the next line when its long Roses00 Excel Discussion (Misc queries) 2 September 14th 06 02:11 PM
Splitting Long Line Dale Excel Programming 1 May 18th 05 02:47 PM


All times are GMT +1. The time now is 12:04 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"