Nyaralist
10-26-2020, 12:58 PM
Hi!
I am New here :)
We updated recently to excel 2016 and when trying to run the onld VBAs we get errors in the code we did not get before the update... maybe there are changes we re not aware...
Also, the code was developed by and external and have no clue what can be going wrong....
We have the following code:
Sub MainReadOpenedFile()
Application.ScreenUpdating = False
GFILENAME = InputBox("Please type your File Name with .xlsx", , "File Name.xlsx")
GPMLibraryMasterSheet = "PM Library (Master)"
If Not Right(GFILENAME, 5) = ".xlsx" Then
GoTo FileErrorHandler
ElseIf GFILENAME = " " Then
GoTo FileErrorHandler
Else:
Application.ScreenUpdating = False
OpenFileCheck = False
Call ReadDataFromFile
End If
Exit Sub
FileErrorHandler:
MsgBox "Not an Excel file, please try again"
End Sub
Sub ReadDataFromFile()
Application.ScreenUpdating = False
Dim PMRoutineInfo(4) As Variant
Dim TLCInfo(4) As Variant
Dim TLCActivityX() As Variant
Dim PMCActivity() As Variant
Dim Compliance As String
Dim PMRoutineSchedule(10) As Variant
Dim TableInfo() As Variant
Dim TLCNo As String
Dim ErrorMessage As String
FirstRow = 3 'First row of file. LastRow if meets "End"
PMStartRow = FirstRow
Do While Not Range("D" & PMStartRow).Value = "End" 'to stop the loop (in column D)
''''
Application.ScreenUpdating = False
Workbooks(OpenFile.GFILENAME).Activate
Worksheets(OpenFile.GPMLibraryMasterSheet).Activate
etc...
But I have been getting errors on these last 2 lines: Run time error '9' "Subscript out of range"
I am moving teams and must handover this soon, so was trying to test it to show it to my successor, but I cannot figure out what can be wrong here since I did not do the code, only guided the development of it, please your help!
Thank youu!!
I am New here :)
We updated recently to excel 2016 and when trying to run the onld VBAs we get errors in the code we did not get before the update... maybe there are changes we re not aware...
Also, the code was developed by and external and have no clue what can be going wrong....
We have the following code:
Sub MainReadOpenedFile()
Application.ScreenUpdating = False
GFILENAME = InputBox("Please type your File Name with .xlsx", , "File Name.xlsx")
GPMLibraryMasterSheet = "PM Library (Master)"
If Not Right(GFILENAME, 5) = ".xlsx" Then
GoTo FileErrorHandler
ElseIf GFILENAME = " " Then
GoTo FileErrorHandler
Else:
Application.ScreenUpdating = False
OpenFileCheck = False
Call ReadDataFromFile
End If
Exit Sub
FileErrorHandler:
MsgBox "Not an Excel file, please try again"
End Sub
Sub ReadDataFromFile()
Application.ScreenUpdating = False
Dim PMRoutineInfo(4) As Variant
Dim TLCInfo(4) As Variant
Dim TLCActivityX() As Variant
Dim PMCActivity() As Variant
Dim Compliance As String
Dim PMRoutineSchedule(10) As Variant
Dim TableInfo() As Variant
Dim TLCNo As String
Dim ErrorMessage As String
FirstRow = 3 'First row of file. LastRow if meets "End"
PMStartRow = FirstRow
Do While Not Range("D" & PMStartRow).Value = "End" 'to stop the loop (in column D)
''''
Application.ScreenUpdating = False
Workbooks(OpenFile.GFILENAME).Activate
Worksheets(OpenFile.GPMLibraryMasterSheet).Activate
etc...
But I have been getting errors on these last 2 lines: Run time error '9' "Subscript out of range"
I am moving teams and must handover this soon, so was trying to test it to show it to my successor, but I cannot figure out what can be wrong here since I did not do the code, only guided the development of it, please your help!
Thank youu!!