Hello all,
I found a solution on this site to a problem I was having in excel. A few small changes were needed, but then it worked flawlessly. After several times of running the code, I tried again today, but now it doesn't add any new information. It runs the script, no errors, and then doesn't paste any data. I have no idea why it has randomly stopped working.
Code:
Sub BulkImport()
Dim InFileNames As Variant
Dim fCtr As Long
Dim tempWkbk As Workbook
Dim consWks As Worksheet
Set consWks = ThisWorkbook.Sheets(1)
InFileNames = Application.GetOpenFilename _
(FileFilter:="Excel Files, *.*", MultiSelect:=True)
Application.ScreenUpdating = False
If IsArray(InFileNames) Then
For fCtr = LBound(InFileNames) To UBound(InFileNames)
With Workbooks.Open(Filename:=InFileNames(fCtr))
.Sheets(1).Range("A2:I" & .Sheets(1).Range("A" & .Sheets(1).Rows.Count).End(xlUp).Row).Copy consWks.Range("A" & consWks.Rows.Count).End(xlUp)(2)
.Close 0
End With
Next fCtr
Else
MsgBox "No file selected"
End If
With Application
.StatusBar = True
.ScreenUpdating = True
End With
End Sub
Any ideas?
Thanks,
Amit
Bookmarks