Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Update WorkBooks in Folder

Hi JavyD

Try this for all files in the folder C:\Data (it change A5 and B5 of the first worksheet)


Copy this code in a workbook outside the folder C:\Data and run it

Sub Test()
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Do While FNames < ""
Set mybook = Workbooks.Open(FNames)

mybook.Worksheets(1).Range("A5,B5").Value = 1.3325

mybook.Close True
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JavyD" wrote in message ...
Hey guys,

Lets see if this possible with a VBA. I have over 100 work books in a
folder. There's two specific cells in each work book that I need to change.
Currently the cell is multiplying a figure times 1.40, I need a VBA if
possible to take each work book in that folder, and replace 1.40 with 1.3325
in those two cells. Those two cells being D17 and C25. Is this possible.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Update WorkBooks in Folder

Hi

The Workbook open have a argument for that (UpdateLinks )
See the VBA help for this



--
Regards Ron de Bruin
http://www.rondebruin.nl


"JavyD" wrote in message ...
Ron, thanks, with your formula, sorry I forgot to mention before, each work
book that I guess it's adjusting, it ask me to update the v look ups in the
work book, can that be stopped?

"Ron de Bruin" wrote:

Hi JavyD

Try this for all files in the folder C:\Data (it change A5 and B5 of the first worksheet)


Copy this code in a workbook outside the folder C:\Data and run it

Sub Test()
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Do While FNames < ""
Set mybook = Workbooks.Open(FNames)

mybook.Worksheets(1).Range("A5,B5").Value = 1.3325

mybook.Close True
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JavyD" wrote in message ...
Hey guys,

Lets see if this possible with a VBA. I have over 100 work books in a
folder. There's two specific cells in each work book that I need to change.
Currently the cell is multiplying a figure times 1.40, I need a VBA if
possible to take each work book in that folder, and replace 1.40 with 1.3325
in those two cells. Those two cells being D17 and C25. Is this possible.






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
Loop through folder of workbooks and add rows FIRSTROUNDKO via OfficeKB.com Excel Worksheet Functions 0 August 10th 06 07:50 PM
Copy a cell to all workbooks within a folder. Andy T Excel Discussion (Misc queries) 16 February 2nd 05 11:14 PM
calculating formulas for all workbooks in a folder Chad Excel Worksheet Functions 3 November 13th 04 05:22 PM
Reading information from all workbooks in a folder... H. Rye Excel Programming 2 January 2nd 04 02:55 PM
list Workbooks in Current Folder jC! Excel Programming 4 December 27th 03 01:12 AM


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