Hi,

I have a spreadsheet that I am using to generate a string of data (all numbers) on one sheet depending on data that is located in another sheet. I have successfully made it automatically generate two lines of code (taking up two seperate rows) for every one row that is referenced on the other sheet. The problem is I have a population if hundreds of thousands of rows (most of which will not be returning a line of code as a result of conditions I established) that need to be checked and I cannot use autofill. Here are the formulas:

Line 1 should be
=IF(Sheet1!$S2="","",("776"&TEXT(Sheet1!$A2,"000000000")&"32"&TEXT(Sheet1!$C2,"YYMMDD")&" 41 "&TEXT(Sheet1!$E2,"00")&TEXT(Sheet1!$G2,"00")&"00"&REPT("0",9-LEN(Sheet1!$S2))&Sheet1!$S2&REPT("0",9-LEN(Sheet1!$S2))&Sheet1!$S2&" & 1"))

Line 1 should be
=IF(Sheet1!$T2="","",("776"&TEXT(Sheet1!$A2,"000000000")&"32"&TEXT(Sheet1!$C2,"YYMMDD")&" 41 "&TEXT(Sheet1!$E2,"00")&"07"&"00"&REPT("0",9-LEN(Sheet1!$T2))&Sheet1!$T2&REPT("0",9-LEN(Sheet1!$T2))&Sheet1!$T2&" & 1"))

I'd like those two lines to replicate down column A, with the values S2,T2,A2,C2... to change to S3,T3,A3,C3....., and S4,T4,A4,C4.....etc. I'd also like to have this work automatically without having to run a macro. I'm assuming VB will have to be used and have even written a loop that might take care of this but do not know how to apply it to VB as i've never used it before.

I know it seems complicated but I would appreciate any input or ideas that anyone may have about how to accomplish this.

Thanks!