Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Run-time error 91

Posted on 2014-09-08
7
168 Views
Last Modified: 2014-09-08
Folks,
When my workbook is launched it opens with the following error:
DashboardI added in the Name Manager a range at AA from the Topics worksheet and it is labeled TextFormulaFunction. No problem here.
My workbook requires I add the worksheet name to the worksheet "SheetNames" - no problem here.
My workbook requires the name of a Category in the Topics worksheet at AE - no problem here.
Code was need on the Menu tab in the Worksheet_SelectionChange event. No problem here
However, when I select the new Category, in the case Text Formulas and Function I get this:
Objectat this part of the code
run time errorMy ranges from A:Z work fine. It's when I go beyond Z that this problem comes up
Dashboard-rev.xlsm
0
Comment
Question by:Frank Freese
  • 4
  • 3
7 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40310677
Just before the last line in Workbook_Open add

Sheets("Menu").Activate
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 500 total points
ID: 40310689
You should also add Application.ScreenUpdaing lines so that the sub looks like this
Private Sub Workbook_Open()

    Application.ScreenUpdating = False
    
    GenCategoryFormulas Sheets("Topics").Range("Category").Rows.Count
    
    Sheets("ScrollbarData").Range("C3").Value = Range("Category").Rows.Count

    ' Select the first category
    Range("A3").Select

    ActiveWindow.Zoom = 90
    '  Make sure that the statusbar is visible
    Application.DisplayStatusBar = True
    
    Application.StatusBar = "Concept and design by Frank Freese. Programming by MartinLiss at www.experts-exchange.com."
    
    Sheets("Menu").Activate
    ActiveSheet.ScrollBars("vscrTopic").Value = 1
    
    Application.ScreenUpdating = True
    
End Sub

Open in new window

0
 

Author Comment

by:Frank Freese
ID: 40310727
Before I actually change the code in the Workbook_Open event I want to be positive this is what you're asking:
Private Sub Workbook_Open()

    Application.ScreenUpdating = False
    
    GenCategoryFormulas Sheets("Topics").Range("Category").Rows.Count
    
    Sheets("ScrollbarData").Range("C3").Value = Range("Category").Rows.Count

    ' Select the first category
    Range("A3").Select

    ActiveWindow.Zoom = 90
    '  Make sure that the statusbar is visible
    Application.DisplayStatusBar = True
    
    Application.StatusBar = "Concept and design by Frank Freese. Programming by MartinLiss at www.experts-exchange.com."
    
    Sheets("Menu").Activate
    ActiveSheet.ScrollBars("vscrTopic").Value = 1
    Sheets("Menu").Activate
    Application.ScreenUpdating = True
    
End Sub

Open in new window

0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40310747
You don't need line 20 in your code. Even after you make that change you'll run into another problem which I'm working on now.
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40310779
The problems occurred when you actually clicked Text Formulas and Functions
The first problem was mine and was due to the gstrTopicCol calculation in Menu's Worksheet_SelectionChange event. It worked fine when the Topics column was a single letter, but the new AA column caused a problem. Here's the fix.

In that sub, change
gstrTopicCol = Mid$(Range("D3").Formula, InStr(1, Range("D3").Formula, "!") + 1, 1)

Open in new window

to
    Dim intStartPos As Integer
    Dim intEndPos As Integer
    intStartPos = InStr(1, Range("D3").Formula, "!") + 1
    intEndPos = InStr(intStartPos, Range("D3").Formula, ",") - 1
    gstrTopicCol = Mid$(Range("D3").Formula, intStartPos, intEndPos - intStartPos)

Open in new window


To be consistent the two new Dim statements should be moved to the top of the sub with the rest of them.

The other problem is yours.
In Name Manager you had TextFormulaFunction as the name of your new range while in code you referred in at least one of the two places that name is referred to you had TextFormulaFunctions. I changed the Named Range name to TextFormulaFunctions and made sure that both places in the code matched.
0
 

Author Comment

by:Frank Freese
ID: 40310848
OK...look like we're back on track. Changes from this thread have been implemented. Looks good.
Thanks again.
0
 

Author Closing Comment

by:Frank Freese
ID: 40310856
again, many thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question