S
Scott
Hi there,
i am hoping you can help.
i hav the following code (see below) which takes numbers from multiple
spreadsheets etc (and it works well) however i am trying to do 1 last thing
and that is as follows:
The number that is placed in cell (iRow, 6) i would like to have tallied at
the end of the script, so for instance if there are 70 numbers then i would
like to leave a space and have a tally appear just underneath it in Cell 'f'
Line 72. Is this easy to do?
Thanking you in advance
Scott
Sub SubGetMyData()
Application.ScreenUpdating = False
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objSubfolder As Scripting.Folder
Dim objFile As Scripting.File
Dim iRow As Long
iRow = 3
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("e:\scott\Sotek\Invoices\")
For Each objFile In objFolder.Files
If objFile.Type = "Microsoft Excel Worksheet" Then
Workbooks.Open Filename:=objFolder.Path & "\" & objFile.Name
With ActiveWorkbook.Worksheets(1)
.Range("A13").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 1)
.Range("A14").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 2)
.Range("A15").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 3)
.Range("F7").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 4)
.Range("F8").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 5)
ThisWorkbook.Worksheets(1).Cells(iRow, 6).Value =
..Range("f45").Value
End With
ActiveWorkbook.Close savechanges:=False
iRow = iRow + 1
End If
Next
Application.ScreenUpdating = True
End Sub
i am hoping you can help.
i hav the following code (see below) which takes numbers from multiple
spreadsheets etc (and it works well) however i am trying to do 1 last thing
and that is as follows:
The number that is placed in cell (iRow, 6) i would like to have tallied at
the end of the script, so for instance if there are 70 numbers then i would
like to leave a space and have a tally appear just underneath it in Cell 'f'
Line 72. Is this easy to do?
Thanking you in advance
Scott
Sub SubGetMyData()
Application.ScreenUpdating = False
Dim objFSO As Scripting.FileSystemObject
Dim objFolder As Scripting.Folder
Dim objSubfolder As Scripting.Folder
Dim objFile As Scripting.File
Dim iRow As Long
iRow = 3
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("e:\scott\Sotek\Invoices\")
For Each objFile In objFolder.Files
If objFile.Type = "Microsoft Excel Worksheet" Then
Workbooks.Open Filename:=objFolder.Path & "\" & objFile.Name
With ActiveWorkbook.Worksheets(1)
.Range("A13").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 1)
.Range("A14").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 2)
.Range("A15").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 3)
.Range("F7").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 4)
.Range("F8").Copy
Destination:=ThisWorkbook.Worksheets(1).Cells(iRow, 5)
ThisWorkbook.Worksheets(1).Cells(iRow, 6).Value =
..Range("f45").Value
End With
ActiveWorkbook.Close savechanges:=False
iRow = iRow + 1
End If
Next
Application.ScreenUpdating = True
End Sub