LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VBA Post

Could someone please tell me what this vba code is doing? Especially the top
part ... where it says; Dim fso f ... Thanks.

Sub LoopThroughFolder()
Dim fso, f, fldnm As String, WB As Workbook, WS As Worksheet, r As Long
Dim ws2 As Worksheet
Set fso = CreateObject("Scripting.FileSystemObject")

fldnm = "C:\Documents and Settings\moyea0\My Documents\And\10K\2005\Data"
'Folder to loop through
Set WS = Workbooks("10K_DataEntry.xls").Sheets("Data")

r = WS.Cells.Find(What:="*", LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row + 1
Application.ScreenUpdating = False
For Each f In fso.GetFolder(fldnm).Files
If UCase(Right(f.Name, 3)) = "XLS" Then
Set WB = Workbooks.Open(f.Path)
Set ws2 = WB.Sheets("WOR Summary")
With WS.Rows(r)
.Columns("J") = ws2.Range("C2").Value
.Columns("L") = ws2.Range("C4").Value
.Columns("M") = ws2.Range("C7").Value
.Columns("N") = ws2.Range("C9").Value
.Columns("O") = ws2.Range("F2").Value
.Columns("P") = ws2.Range("F3").Value
.Columns("Q") = ws2.Range("F4").Value
.Columns("R") = ws2.Range("F5").Value
.Columns("S") = ws2.Range("F6").Value
.Columns("T") = ws2.Range("F7").Value
.Columns("U") = ws2.Range("F8").Value
.Columns("V") = ws2.Range("F9").Value
.Columns("W") = ws2.Range("F10").Value
.Columns("X:BG") = Application.Transpose(ws2.Range("F13:F48").Value)
.Columns("BH") = ws2.Range("F50").Value
.Columns("BI:BN") = Application.Transpose(ws2.Range("F54:F59").Value)
End With
r = r + 1
WB.SaveAs fldnm & "\archive1\" & f.Name
WB.Close
f.Delete
End If
Next
Application.ScreenUpdating = True
End Sub
 
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
Before my first post crehan57 About this forum 0 September 18th 10 08:56 PM
Post Newfie809 Excel Worksheet Functions 2 October 22nd 09 09:47 PM
my post Help with cell function[_2_] Excel Discussion (Misc queries) 3 October 8th 09 02:31 PM
Further to my other post.... Connie Martin Excel Worksheet Functions 4 March 20th 09 07:56 PM
Should I generally request "post a poll" when I post a new thread? Joe Miller Excel Discussion (Misc queries) 2 January 7th 06 04:46 PM


All times are GMT +1. The time now is 05:31 AM.

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"