Hi, To wrap the formula in VBA, use a space then an underline, but not within double quotes. You have to split at a point outside the double quotes.
eg: WS3.Cells(iRow, 11).Formula = "=IF(NAMES!AR" _ & j & "<>"""",NAMES!AR1,IF(NAMES!AS" & j & "<>"""",NAMES!AS1,IF(NAMES!AT" _ & j & "<>"""",NAMES!AT1,IF(NAMES!AU" & j & "<>"""",NAMES!AU1,IF(NAMES!AV" _ & j & "<>"""",NAMES!AV1,IF(NAMES!AW" & j & "<>"""",NAMES!AW1,IF(NAMES!AX" _ & j & "<>"""",NAMES!AX1,IF(NAMES!AY" & j & "<>"""",NAMES!AY1,""""))))))))" But I can't answer your question about going to CE, sorry. Regards - Dave. > Date: Wed, 23 Sep 2009 17:24:05 -0700 > Subject: $$Excel-Macros$$ Complicated nested IF inside cell formula macro > From: cad...@gmail.com > To: excel-macros@googlegroups.com > > > Hi Everyone, > > I'm having troubles with this formula. It currently works. But I > would like to extend the range out to column CE. > There are 2 problems: > > 1). I would like to wrap the text of this formula so that it appears > as 4 lines in the vba editor. It's too hard to read > as 1 gigantic line. > > 2). I would like to make the if statement go out to column CE and I > can't seem to make it work beyond column AY. > > Can someone please help? > > WS3.Cells(iRow, 11).Formula = "=IF(NAMES!AR" & j & "<>"""",NAMES!AR1,IF > (NAMES!AS" & j & "<>"""",NAMES!AS1,IF(NAMES!AT" & j & "<>"""",NAMES! > AT1,IF(NAMES!AU" & j & "<>"""",NAMES!AU1,IF(NAMES!AV" & j & > "<>"""",NAMES!AV1,IF(NAMES!AW" & j & "<>"""",NAMES!AW1,IF(NAMES!AX" & > j & "<>"""",NAMES!AX1,IF(NAMES!AY" & j & "<>"""",NAMES! > AY1,""""))))))))" > > > _________________________________________________________________ Use Messenger in your Hotmail inbox Find out how here http://windowslive.ninemsn.com.au/article.aspx?id=823454 --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,500 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---