It looks to me as though you are trying to copy the C12 on Sheet1 in the vFile workbook to B1 on the Data sheet in vFile. Given that you are using getopenfilename, presumably the file that is open sometimes doesn't have a sheet named Data?
Maybe try:
Sub test()
Dim wb As Workbook
Dim wb2 As Workbook
Dim vFile As Variant
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlManual
Set wb = ActiveWorkbook
vFile = Application.GetOpenFilename("Excel-files,*.xlsx", _
1, "Select One File To Open", , False)
If TypeName(vFile) = "Boolean" Then Exit Sub
Set wb2 = Workbooks.Open(vFile)
wb.Sheets("Data").Range("B1").Value = wb2.Sheets(1).Range("C12").Value
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Bookmarks