streng Posted May 13, 2009 Posted May 13, 2009 I am struggling to set up a for next loop, once i get this I think the rest will all fall into place. The repeating code from row1 to end1 is as follows Row1 = 2 End1 = DrgNo + 2 objXL.Range("R" & Row1).Formula = "=IF(ISBLANK(D & Row1),D & Row1,CONCATENATE(D & Row 1,"" "",E & Row1,"" "",F & Row1)))" This inserts code is an excel spreadsheet starting at Cell R2 and ends at End1. Hope I have explained myself correctly. Quote
SEANT Posted May 14, 2009 Posted May 14, 2009 Try: End1 = DrgNo + 2 For Row1 = 2 to End1 objXL.Range("R" & Row1).Formula = "=IF(ISBLANK(D & Row1),D & Row1,CONCATENATE(D & Row 1,"" "",E & Row1,"" "",F & Row1)))" Next Quote
streng Posted May 14, 2009 Author Posted May 14, 2009 Thanks managed to sort it, I used R1C1 Formula objXL.Cells(RowNum, 18).FormulaR1C1 = "=IF(ISBLANK(RC[-14]),"" "",IF(ISBLANK(RC[-10]),RC[-14],CONCATENATE(RC[-14],"" "",RC[-13],"" "",RC[-12])))" Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.