Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default Total or summing in a workbook within a folder

Hello,

I have a folder that contains about 25 workbooks, currently each workbook I
do the sum function and put the work "Total" in column A. Each of the
workbooks may have 1 or 50 rows. I still have open each workbook and put
totals (only two columns for totaling) and the word "Total" in column A. Is
it possible to have a global vba coding to put totals in all the workbook
and have the word "Total"? Any tips or visit a web site will be appreciate.
Thank you in advance. I don't think this is easy.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Total or summing in a workbook within a folder

Hi Cam

So which column are you putting the Sum function in, Column B? Is
the word 'total' going at the very bottom of a supposed list of
descriptive names in Column A?

Take care

Marcus
  #3   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default Total or summing in a workbook within a folder

HI Marcus,

Thanks for asking. Actually column D and column E will summed and on the
same line of the summed column A will have the word "Total" that column is
called "Name". Thanks

Cheers

"marcus" wrote in message
...
Hi Cam

So which column are you putting the Sum function in, Column B? Is
the word 'total' going at the very bottom of a supposed list of
descriptive names in Column A?

Take care

Marcus


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Total or summing in a workbook within a folder

Hi Cam

OK so here we go. This opens all the files in a specific directory
and places “Total” at the bottom of column A, sums the numbers in
Columns D and E placing the formula in the same row as column A. It
assumes the Numbers start in Row 2 so you may have to change this to
suit if necessary.

You will need to change the file path “.Lookin = “C:\Yourpathhere
No need to prefix your path with .xls as this is catered for.

It saves the changes at present but you might like to run a trial with
a sample of files which open make the changes and do not save.

wkbk.Close SaveChanges:=False

Good luck with it.

Take care

Marcus


Sub OpenFiles()

Dim wkbk As Workbook
Dim Lw As Integer, Sr As Integer

With Application.FileSearch
.NewSearch
.LookIn = "c:\users\smallman\excel"
.SearchSubFolders = False
.Filename = ".xls"
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Set wkbk = Workbooks.Open(.FoundFiles(i))
Lw = Range("A" & Rows.Count).End(xlUp).Row + 1
Sr = Lw - 1 'for the Sum row
Range("A" & Lw).Value = "Total"
Range("D" & Lw).Value = "=SUM(D2:D" & Sr & ")"
Range("E" & Lw).Value = "=SUM(E2:E" & Sr & ")"

wkbk.Close SaveChanges:=True
Next i

End If
End With
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Total or summing in a workbook within a folder

I think this will do what you want:
http://www.rondebruin.nl/copy4.htm


Regards,
Ryan---

--
RyGuy


"marcus" wrote:

Hi Cam

OK so here we go. This opens all the files in a specific directory
and places €śTotal€ť at the bottom of column A, sums the numbers in
Columns D and E placing the formula in the same row as column A. It
assumes the Numbers start in Row 2 so you may have to change this to
suit if necessary.

You will need to change the file path €ś.Lookin = €śC:\Yourpathhere
No need to prefix your path with .xls as this is catered for.

It saves the changes at present but you might like to run a trial with
a sample of files which open make the changes and do not save.

wkbk.Close SaveChanges:=False

Good luck with it.

Take care

Marcus


Sub OpenFiles()

Dim wkbk As Workbook
Dim Lw As Integer, Sr As Integer

With Application.FileSearch
.NewSearch
.LookIn = "c:\users\smallman\excel"
.SearchSubFolders = False
.Filename = ".xls"
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
Set wkbk = Workbooks.Open(.FoundFiles(i))
Lw = Range("A" & Rows.Count).End(xlUp).Row + 1
Sr = Lw - 1 'for the Sum row
Range("A" & Lw).Value = "Total"
Range("D" & Lw).Value = "=SUM(D2:D" & Sr & ")"
Range("E" & Lw).Value = "=SUM(E2:E" & Sr & ")"

wkbk.Close SaveChanges:=True
Next i

End If
End With
End Sub

Reply
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
summing total sales formula Charles Excel Discussion (Misc queries) 1 May 21st 10 10:44 PM
summing 3 worksheets on a total sheet jliv Excel Discussion (Misc queries) 1 February 18th 09 06:48 PM
summing a row, remove lowest values from the total randy chapman Excel Discussion (Misc queries) 2 February 20th 08 01:56 PM
Problem with summing formula updating Total... Dave Excel Discussion (Misc queries) 2 November 21st 06 05:46 PM
Need help summing the total of two columns with their products mike_vr Excel Discussion (Misc queries) 3 December 16th 05 04:01 PM


All times are GMT +1. The time now is 03:10 AM.

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

About Us

"It's about Microsoft Excel"