+ Reply to Thread
Results 1 to 2 of 2

Runtime error 9 "subscript out of range"

  1. #1
    Registered User
    Join Date
    03-13-2019
    Location
    china
    MS-Off Ver
    2016
    Posts
    1

    Runtime error 9 "subscript out of range"

    Hello everyone!

    Problem:– runtime error 9, “subscript out of range” - everywhere!
    Sub MacroRefresh(Control As IRibbonControl)
    Dim lRet As Long
    Dim pc As PivotCache
    Dim pivotTableExists

    pivotTableExists = False
    For Each pc In ActiveWorkbook.PivotCaches
    pivotTableExists = True
    Next

    If Not pivotTableExists Then
    GoTo No_Pivot_Table
    End If

    'EA: Refresh on Custom/non Wellbase reports gives exception.
    Dim propertySheet As Worksheet
    On Error Resume Next
    Set propertySheet = Sheets("Properties")
    Dim sql As String

    If Not propertySheet Is Nothing Then
    sql = propertySheet.Cells(4, 2).value
    End If

    If propertySheet Is Nothing Or Len(sql) <= 0 Then
    MsgBox "Cannot refresh this pivot report." & vbNewLine & "You can only use this feature with reports generated from WellBase.", vbOKOnly, "Caution!"
    Exit Sub
    End If

    Public Function ParseXMLTemplate(filename As Variant) As Boolean

    Dim lngIndex As Long
    Dim XDoc As MSXML2.DOMDocument
    Dim xmlRoot As Object
    Dim xTemplates As MSXML2.IXMLDOMNodeList, template As MSXML2.IXMLDOMElement
    Dim xColumns As MSXML2.IXMLDOMNodeList, column As MSXML2.IXMLDOMElement
    Dim xRows As MSXML2.IXMLDOMNodeList, row As MSXML2.IXMLDOMElement
    Dim xFilters As MSXML2.IXMLDOMNodeList, filter As MSXML2.IXMLDOMElement
    Dim xValues As MSXML2.IXMLDOMNodeList, value As MSXML2.IXMLDOMElement
    Dim propertySheet As Worksheet

    On Error GoTo Errhandler:

    If Len(filename) = 0 Then
    ParseXMLTemplate = False
    Exit Function
    End If

    I am using Excel 2016.

    Macros tried available upon request.

    Can anyone help?

    Best regards,

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Runtime error 9 "subscript out of range"

    Welcome to the board.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Urgent help needed - "Runtime error 9: subscript out of range"
    By lostman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2018, 12:04 PM
  2. Runtime Error 9 "Subscript Out of Range" Assistance
    By hg_macro_support in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-18-2016, 05:28 AM
  3. Runtime error 9 "subscript out of range"
    By PUZEYQUIN in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2014, 11:38 AM
  4. Runtime error 9 "subscript out of range"
    By Frustratedemployee in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-30-2013, 06:48 PM
  5. Runtime error 9 "subscript out of range"
    By eLakmal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-08-2013, 10:09 PM
  6. [SOLVED] Runtime error 9 "subscript out of range"
    By MyCousinVinnie in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-08-2012, 11:28 PM
  7. Error msgs: "Object varible or with block variable not set"; "subscript out of range"
    By menyanthe in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-26-2009, 04:58 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1