Exporting To Excel-Very Intersting but strucked

HiI am creating a database,which will export the data from notes to excel in specific format,

As I am new to Lotus Script but some how i manage to learn Little bit of Lotus Script and start doing the exporting part.

Upto Exporting part I am able to export the documents but i need the documents in Table Format.

But the Table Rows and columns are not Fixed,depending on the documents it should create rows and columns.

I am pasting some of my code,can anyone help me out to arrange my exporting.

n=1

A=1

Here N and A I am trying to fetch the Rows and Column Values,i know my logic is not correct

Do While Not doc Is Nothing

B=1

datetime.LSLocalTime=doc.logged(0)

efromD.LSLocalTime=thisdoc.efromD(0)

etoD.LSLocalTime=thisdoc.etoD(0)

If dateTime.DateOnly>=efromD.dateonly Then

If dateTime.DateOnly<=etoD.dateonly Then

n = n + 1

'Printing the Column Heading in the Cells

excelApp.sheets(1).range(“A” & Cstr(3)).value = “Breakup of IS Requests for the Month Of-----”

excelApp.Selection.ColumnWidth = 15

excelApp.Range(“A3”).Font.Bold = True

excelApp.Range(“A3”).Font.ColorIndex = 1

excelApp.sheets(1).range(“B” & Cstr(n) &Cstr(A)).value = doc.r_category(0)

A=A+1

Assigned=doc.r_assignedto(0)+doc.r_category(0)

Set doc1=view.getdocumentbykey(Assigned)

Set vc = view.GetAllEntriesByKey(Assigned)

B=vc.count

excelApp.sheets(1).range(“B” & Cstr(n)&Cstr(A)).value = B

A=A+1

excelApp.sheets(1).range(“B” & Cstr(n)&Cstr(A)).value = doc.r_assignedto(0)

End If

End If

Set doc = view.getnextdocument(doc)

Loop