Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default cannot get total


ThisWorkbook.Worksheets(1).Cells(iCol, 6).Value = _
.Range("F45").Copy

Will put the value of F45 in your worksheet.

Cells(row, col)

why use a variable named icol to refer to the row?

Regards,
Tom Ogilvy


Scott wrote in message
...
Hi There,

i have the following code (see below) but i cannot get the total or the
balance of each spreadsheet.
you see F45 is the result of adding F41+F43+F44, so by copying the
destination i will only get a #ref
any assistance is greatly appreciated

Sub SubGetMyData()
Application.ScreenUpdating = False

Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objSubfolder As Scripting.Folder
Dim objFile As Scripting.File
Dim iCol As Long

iCol = 3
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("e:\scott\blah\")
For Each objFile In objFolder.Files
If objFile.Type = "Microsoft Excel Worksheet" Then
Workbooks.Open Filename:=objFolder.Path & "\" & objFile.Name
With ActiveWorkbook.Worksheets(1)
.Range("A13").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 1)
.Range("A14").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 2)
.Range("A15").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 3)
.Range("F7").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 4)
.Range("F8").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 5)
.Range("F45").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iCol , 6)
End With
ActiveWorkbook.Close savechanges:=False
iCol = iCol + 1
End If
Next

Application.ScreenUpdating = True
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
Duplicate Running Total Grand Total In Pivot Table Mathew P Bennett[_2_] Excel Discussion (Misc queries) 1 August 17th 08 03:13 AM
Excel 2002 : Any single button to get sub total and grand total ? Mr. Low Excel Discussion (Misc queries) 2 May 22nd 07 08:46 AM
Total column changes colors when total equals sum of other columns newstacy New Users to Excel 1 April 21st 07 09:00 PM
calculate count on 2006 total, 2005 total, etc... Amanda Deshotel Excel Worksheet Functions 6 September 28th 06 11:59 PM
Adding Data Using Multiple Worksheets to Total into a Grand Total Lillie Excel Worksheet Functions 1 April 19th 05 08:34 PM


All times are GMT +1. The time now is 12:26 PM.

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"