Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Manipulating code for reading cell values from workbooks in dir

Hi Guys,

Need some help in manipulating a code;

I have alot of excelsheets in a certain dir. Now i want to collect all
the cellvalues "O76 from Sheet1" from each workbook. (workbooks are
all same layout) and collect them in a new sheet with the filenames
(for a lookup afterwards).

The code works fine except i get messageboxes 1) the file to select,
2) the sheetname (i need the data on sheet1).

I want excel to loop trough the dir instead of asking for
verification;

Here's the code so far:

Sub MakeLinksUsingDir()
Dim myPath As String
Dim WorkFile As String
Dim MyFormula As String
Dim i As Integer


myPath = "z:\Techniek\7_Qesh\PSV berekeningen\Definitieve Berekeningen
\Gasfase\"
i = 1


WorkFile = Dir(myPath & "*.xls")
Do While WorkFile < ""
MsgBox WorkFile


'Generate myFormula through string manipulation
MyFormula = "='" & myPath & "[" & _
WorkFile _
& "]Sheet1'!"
'Set cell formulas
Cells(i, 1).Value = WorkFile
Cells(i, 2).Formula = MyFormula & "O76"
i = i + 1
WorkFile = Dir()
Loop
End Sub


Thanks so much for the help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Manipulating code for reading cell values from workbooks in dir

Does this simple one help?
Sub getfiledata()
Application.ScreenUpdating = False
Dim FN As String
FileLocation = "c:\a\*.xls"
On Error Resume Next
FN = Dir(FileLocation)
i = 1
Do Until FN = ""

' MsgBox FN
Cells(i, 1) = FN
Cells(i, 2).Formula = "='C:\a\[" & FN & "]sheet1'!$A$4"
FN = Dir
i = i + 1
Loop
Application.ScreenUpdating = True
End Sub

--
Don Guillett
SalesAid Software

wrote in message
oups.com...
Hi Guys,

Need some help in manipulating a code;

I have alot of excelsheets in a certain dir. Now i want to collect all
the cellvalues "O76 from Sheet1" from each workbook. (workbooks are
all same layout) and collect them in a new sheet with the filenames
(for a lookup afterwards).

The code works fine except i get messageboxes 1) the file to select,
2) the sheetname (i need the data on sheet1).

I want excel to loop trough the dir instead of asking for
verification;

Here's the code so far:

Sub MakeLinksUsingDir()
Dim myPath As String
Dim WorkFile As String
Dim MyFormula As String
Dim i As Integer


myPath = "z:\Techniek\7_Qesh\PSV berekeningen\Definitieve Berekeningen
\Gasfase\"
i = 1


WorkFile = Dir(myPath & "*.xls")
Do While WorkFile < ""
MsgBox WorkFile


'Generate myFormula through string manipulation
MyFormula = "='" & myPath & "[" & _
WorkFile _
& "]Sheet1'!"
'Set cell formulas
Cells(i, 1).Value = WorkFile
Cells(i, 2).Formula = MyFormula & "O76"
i = i + 1
WorkFile = Dir()
Loop
End Sub


Thanks so much for the help!


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
Reading & manipulating the Excel data programatically in C# progra Rp007 Excel Programming 0 October 9th 06 05:21 PM
manipulating formula values Ramy Excel Worksheet Functions 4 November 19th 04 04:54 PM
Code for manipulating Lists Cynthia[_4_] Excel Programming 1 April 30th 04 05:37 PM
Reading information from all workbooks in a folder... H. Rye Excel Programming 2 January 2nd 04 02:55 PM
Reading formatted cell values into an array Tom Ogilvy Excel Programming 0 September 19th 03 06:32 PM


All times are GMT +1. The time now is 07:16 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"