Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have one "TOTALS" worksheet where I need to display a total. I need
to cycle through a folder full of excel files, and if the name of the file begins with "Branch" (as in "Branch19Sales.xls") I need to sum up cell C6 on those files in my "TOTALS" worksheet. TIA -Mike *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim fName as String, wkbk as Workbook
Dim rng as Range, tot as Double fName = dir("C:\myfolder\*.xls") do while fname < "" if left(lcase(fName,6)) = "branch" then set wkbk = Workbooks.Open("c:\myfolder\" & fname) set rng = wkbk.Worksheets(1).Range("C6) if isnumeric(rng) then tot = tot + rng.value end if wkbk.Close Savechanges:=False end if fName = Dir() Loop activesheet.Range("B9").Value = tot -- Regards, Tom Ogilvy "Michael Smith" wrote in message ... I have one "TOTALS" worksheet where I need to display a total. I need to cycle through a folder full of excel files, and if the name of the file begins with "Branch" (as in "Branch19Sales.xls") I need to sum up cell C6 on those files in my "TOTALS" worksheet. TIA -Mike *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Doh, for some reason its is giving me an invalid property assignment
error on this line...it doesn't like the LCase formula I believe. What am I missing? If Left(LCase(fName, 6)) = "branch" Then *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
assign value based on criteria and total | Excel Discussion (Misc queries) | |||
Grand total based on sub-total | Excel Discussion (Misc queries) | |||
total amount based on selections of 1-9, 10-19 and 20-30 | Excel Discussion (Misc queries) | |||
get a total based on criteria in two columns | Excel Worksheet Functions | |||
total based on one constant value | Excel Discussion (Misc queries) |