LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Create cell formula from a relative position

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Position drawing object relative to cell Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 2 September 29th 08 09:16 PM
Excel Formula using relative position of cells in two different worksheets David Virgil Hobbs Excel Discussion (Misc queries) 1 December 14th 06 03:36 AM
Excel Formula using relative position of cells in two different worksheets David Virgil Hobbs Excel Worksheet Functions 1 December 14th 06 03:36 AM
Displaying a cell relative to the position to another cell Tibbs Excel Discussion (Misc queries) 2 July 21st 06 08:28 AM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM


All times are GMT +1. The time now is 04:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"