Hello all, trying to import some fixed cells from multiple excel files. 1st and 2nd cells are text and numbers and import fine, but my third cell is a sum (H47:H49) and shows the formula when imported (#REF!) I'd like to show the total of the sum.
very new to this VBA scripting, what shoudl I change to get my sum from "H50" Cell?
Sub CreateList()
Dim iFilesNum As Integer
Dim intCounter As Integer
Dim lCount As Long
Dim recMyFiles() As FoundFileInfo
Dim wbResults As Workbook
Dim wbDest As Workbook
Dim blFilesFound As Boolean
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbDest = ThisWorkbook
intCounter = -1
blFilesFound = FindFiles("C:\path_to_files", recMyFiles, iFilesNum, "*.xls*", True)
If blFilesFound Then
intCounter = intCounter + 1
For lCount = 1 To iFilesNum 'Loop through all
intCounter = intCounter + 1
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=recMyFiles(lCount).sPath & recMyFiles(lCount).sName, UpdateLinks:=0)
wbResults.Sheets(1).Range("I6").Copy Destination:=wbDest.Sheets(1).Range("A" & intCounter)
wbResults.Sheets(1).Range("B12").Copy Destination:=wbDest.Sheets(1).Range("B" & intCounter)
wbResults.Sheets(1).Range("H50").Copy Destination:=wbDest.Sheets(1).Range("C" & intCounter)
wbResults.Close SaveChanges:=False
Next lCount
End If
On Error GoTo 0
very new to this VBA scripting, what shoudl I change to get my sum from "H50" Cell?
Sub CreateList()
Dim iFilesNum As Integer
Dim intCounter As Integer
Dim lCount As Long
Dim recMyFiles() As FoundFileInfo
Dim wbResults As Workbook
Dim wbDest As Workbook
Dim blFilesFound As Boolean
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbDest = ThisWorkbook
intCounter = -1
blFilesFound = FindFiles("C:\path_to_files", recMyFiles, iFilesNum, "*.xls*", True)
If blFilesFound Then
intCounter = intCounter + 1
For lCount = 1 To iFilesNum 'Loop through all
intCounter = intCounter + 1
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=recMyFiles(lCount).sPath & recMyFiles(lCount).sName, UpdateLinks:=0)
wbResults.Sheets(1).Range("I6").Copy Destination:=wbDest.Sheets(1).Range("A" & intCounter)
wbResults.Sheets(1).Range("B12").Copy Destination:=wbDest.Sheets(1).Range("B" & intCounter)
wbResults.Sheets(1).Range("H50").Copy Destination:=wbDest.Sheets(1).Range("C" & intCounter)
wbResults.Close SaveChanges:=False
Next lCount
End If
On Error GoTo 0