Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to interate through a MS Access recordset copying the field
contents to each sucessive row in an Excel Worksheet using the following code and everything is working fine except I would like to create calculated fields instead for the xlCell.Offset(1, 0).Range("D1").Value = rstRs.Fields("Total Cost").Value such as (C4 * H4) only using the relative row position as the fields are written to the row. I'm also having trouble getting the "xlCell.Offset(0, 4).Range("E1").Font.Bold = True" to bold face the group header written by "xlCell.Offset(0, 4).Value = rstRs!Desc_". Any suggestions would be greatly appreciated. My codes is as follows: Do While rstRs.EOF < True If Not (mCatCode = OldCatCode) Then Set xlCell = xlCell.Offset(1, 0) xlCell.Offset(0, 4).Value = rstRs!Desc_ xlCell.Offset(0, 4).Range("E1").Font.Bold = True OldCatCode = mCatCode End If xlCell.Offset(1, 0).Range("A1").Value = rstRs.Fields("Code").Value xlCell.Offset(1, 0).Range("B1").Value = rstRs.Fields("Bin #").Value xlCell.Offset(1, 0).Range("C1").Value = rstRs.Fields("Price").Value xlCell.Offset(1, 0).Range("D1").Value = rstRs.Fields("Total Cost").Value xlCell.Offset(1, 0).Range("E1").Value = rstRs.Fields("Inventory").Value xlCell.Offset(1, 0).Range("F1").Value = rstRs.Fields("Begin").Value xlCell.Offset(1, 0).Range("G1").Value = rstRs.Fields("Buy").Value xlCell.Offset(1, 0).Range("H1").Value = rstRs.Fields("End").Value xlCell.Offset(1, 0).Range("I1").Value = rstRs.Fields("Total").Value xlCell.Offset(1, 0).Range("J1").Value = rstRs.Fields("Aloha").Value xlCell.Offset(1, 0).Range("K1").Value = rstRs.Fields("Adjust").Value rstRs.MoveNext If rstRs.EOF = False Then mCatCode = rstRs!CatCode End If Set xlCell = xlCell.Offset(1, 0) Loop |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Position drawing object relative to cell | Excel Discussion (Misc queries) | |||
Excel Formula using relative position of cells in two different worksheets | Excel Discussion (Misc queries) | |||
Excel Formula using relative position of cells in two different worksheets | Excel Worksheet Functions | |||
Displaying a cell relative to the position to another cell | Excel Discussion (Misc queries) | |||
Relative Cell position NOT working with or without macro | Excel Discussion (Misc queries) |