Results 1 to 4 of 4

Thread: Debugging VBA built on Excel2013 not working on v2016

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Debugging VBA built on Excel2013 not working on v2016

    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!!
    Last edited by Paul_Hossler; 10-26-2020 at 02:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •