Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to modify a worksheets in different folders

Status
Not open for further replies.

Emario

MIS
Aug 6, 2001
39
0
0
US
Please help. I have 164 timesheets all named pp04. (pay Period)

I need to make a global change to one worksheet called Activities changing the format of cells c10:c164 from the general to the number format.

The spreadsheets are in a folder called SSTracking. In SStracking holds 16 fodlers of the teams (Adminsistration, Commtech, CivilRights, Structurres Etc) In each team folder are the team memberfolder name by user Cdumas, etc

Here is some code that I have tried but I get errors.

Sub AllFolderFiles()
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "C:\Temp"
ChDir MyPath
TheFile = Dir("pp04.xls")
Sheets("Activities").Select
Range("C10:C164").Select
Selection.NumberFormat = "0.00"
ActiveWorkbook.Save
Do While TheFile <> ""
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
MsgBox wb.FullName
wb.Close
TheFile = Dir

Loop
End Sub
Am I on the right track.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top