LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
DMB
 
Posts: n/a
Default How do I which file in collection is being used in the calculation

I am trying to go through each cell in a range, through each worksheet in a
range, and through each wrokbook in a range.
I have got the cell and the worksheets to work but the workbooks are more
chalanging. How do I make sure that the worksheet.cell.data is being
collected from the right workbooks? Right now this program will cycle through
a single workbook a number of times. If I have 3 workbooks open, the program
wil go through and collect data from the same workbook 3 times. data*3

This is the line that is crashing:

file.sht.Cells(cel.Row, cel.Column)

This line works till I add the file to the beginning.


This is the loop:

Dim file As Workbook
Dim sht As Worksheet
Dim cel As Range
Dim j As Integer
Dim Total As Double
Total = 0

For Each file In Workbooks
If UCase(file.Name) < "PERSONAL.XLS" Then
For Each sht In Worksheets
For Each cel In sht.Range("F3:F30")
If file.sht.Cells(cel.Row, cel.Column).Text
="COLLECTDATA" Then
' Total = Total + Round(sht.Cells(cel.Row, cel.Column
- 1), 8)
'End If
Next cel
Next sht
End If
Next file
 
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
Saved *.csv file gives SYLK file type warning upon Excel 2003 open Tom Excel Discussion (Misc queries) 5 March 19th 08 03:15 PM
Pasword protected Excel file encrypted, how do I read this file? jonesteam Excel Discussion (Misc queries) 2 December 12th 05 06:32 PM
Weird File Open/Save As Behavior [email protected] Excel Discussion (Misc queries) 0 December 9th 05 02:26 AM
cannot open excel file, please help!!! sunlite Excel Discussion (Misc queries) 0 September 5th 05 05:29 PM
Locating a file in excel with a partial file name. Audra Excel Discussion (Misc queries) 2 February 19th 05 08:52 PM


All times are GMT +1. The time now is 06:14 AM.

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"