lcCarr_Name = "Carrier"
lcOldCarr_Name = ""
? lcCarr_Name <> lcOldCarr_Name ----> .F.
>>FOR nMonth = 1 TO lnMonths && 12 > WITH oExcel.ActiveSheet > * Select the correct Month's cursor (table). > lcMonth=PADL(nMonth, 2, "0") > lcCursor=("tmpNearly"+lcMonth) > SELECT (lcCursor) > SCAN > lcCarr_Name = &lcCursor..Carr_Name > IF lcCarr_Name <> lcOldCarr_Name && Either frist time in, or you have a new carrier. > * Move down a row for the new Carrier Name. Makes two rows. > oRange = oRange.Offset(1,0) > oExcel.ActiveSheet.Cells(lnRow-1,lnCol).Value = "Monthly-" + lcCarrierName > * Put the name of the first report in A1. > lcAlphaMonth = LEFT(GetAlphaMonth(nMonth),3) > .Cells(lnRow-1,lnCol+3).Value = lcAlphaMonth + " " + lcYear > * Lay out the Columnn Headers from Left to Right. > .Cells(lnRow, lnCol).Value = "Group Name" > .Cells(lnRow, lnCol + 1).Value = "GrpID" > .Cells(lnRow, lnCol + 2).Value = "Emp. ID" > .Cells(lnRow, lnCol + 3).Value = "Benefit" > .Cells(lnRow, lnCol + 4).Value = "Month_Billed" > .Cells(lnRow, lnCol + 5).Value = "Month_Collected" > .Cells(lnRow, lnCol + 6).Value = "Annualized Premium" > .Cells(lnRow, lnCol + 7).Value = "Lives" > ENDIF > *oxcel.ActiveSheet.Cells(lnRow-1,lnCol).Value = "Monthly-" + lcCarrierName > WITH oRange > * Print the columns/fields to the page. This runs left to right on the default row. > .Columns[1].Value = GrpName && Group Name > .Columns[2].Value = GrpID && Group ID > .Columns[3].Value = Emp_ID && Employer's ID > .Columns[4].Value = Benefit && Benefit Name. > .Columns[5].Value = Billed && Monthly Billed Amount By GrpID, Employer. > .Columns[6].Value = Collected && Monthly Collected amount by GrpID, Employer. > .Columns[7].Value = Annualized && Annualized Premium. > .Columns[8].Value = Lives && # of Primary Insured. > * Move down one row. > oRange = oRange.Offset(1,0) > ENDWITH > lcOldCarr_Name = &lcCursor..Carr_Name > ENDSCAN > * Since we've changed months, let's go to the right 9 columns. > lnColsOffSetToRight=lnColsOffSetToRight + 9 > lnCol = lnColsOffSetToRight + 1 > oRange = .Range("A3:H3").Offset(0, lnColsOffSetToRight) > ENDWITH >ENDFOR >