Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

Totaling Columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jimbo@jimbo1.plus.com - 14 Feb 2006 15:49 GMT
I have a document that i am in the process of formatting, however i
need to total up columns of data.  I know where the bottom on the data
will be and can activate the cell either at the last column with data
or the column below this.  this action is then repeated within my loop.

Can anyone help??
Dave Lett - 14 Feb 2006 16:38 GMT
Hi Jimbo,

The following should get your well on your way:

Dim oTbl As Table
Dim lRow As Long
Dim lCount As Long
Set oTbl = ActiveDocument.Tables(1)
lRow = oTbl.Rows.Count
For lCount = 1 To oTbl.Columns.Count
   With oTbl
       Set oRng = .Columns(lCount).Cells(lRow).Range
       oRng.MoveEnd Unit:=wdCharacter, Count:=-1
       oRng.Select
       Selection.InsertFormula Formula:="=Sum(ABOVE)"
   End With
Next lCount

HTH,
Dave

> I have a document that i am in the process of formatting, however i
> need to total up columns of data.  I know where the bottom on the data
> will be and can activate the cell either at the last column with data
> or the column below this.  this action is then repeated within my loop.
>
> Can anyone help??
jimbo@jimbo1.plus.com - 27 Feb 2006 16:43 GMT
all sorted worked it!!!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.