Solved

Adrressing the incorrect worksheet

Posted on 2014-09-21
7
85 Views
Last Modified: 2014-09-22
Folks,
In the attached workbook the Menu tab has Categories, Topic, and Description. Everything was working fine until I added the Category "Dynamic Date Filters" which does list 3 Topics. The problem I'm having is that when I select the previous Category "Interactive Controls" and then select any topic under that Category I'm off one worksheet from where I should be. Everything prior to "Interactive Controls" works fine. I've checked the code and the Range Manager and made sure my sheets were in correct order. Up till then everything was OK. I'm not getting any errors yet I'm not going to the correct sheet. I've looked at it so long I just don't see the problem.
Excel-Dashboards-Rev.xlsm
0
Comment
Question by:Frank Freese
  • 4
  • 3
7 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40335640
In Case 19 in Worksheet_Selection change you are missing

+ Sheets("Topics").Range("DynamicLabels").Rows.Count _
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 500 total points
ID: 40335644
You are also missing it in Case 20.
0
 

Author Closing Comment

by:Frank Freese
ID: 40335661
Thank you - I just couldn't see the problem. Everything is ok now.
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40335695
You're welcome. BTW I don't know if it happens to you, but if I double-click a Topic that doesn't yet have an associated sheet in SheetNames, Excel crashes. To prevent that add line 23 in MainMenu's code.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim strSheetName As String
Dim lngLastRow As Long

On Error GoTo ErrorRoutine

lngLastRow = Range("D65536").End(xlUp).Row
If Not Intersect(ActiveCell, Range("D3:D" & lngLastRow)) Is Nothing Then
    If ActiveCell.Value = "" Then
        Range("D3").Select
        Exit Sub
    End If
    strSheetName = Worksheets("SheetNames").Range("ShowSheet")(intCatFactor + Target.Row + Sheets("ScrollbarData").Range("B2") - 3)

    Sheets(strSheetName).Activate
    Sheets(strSheetName).Select
    Sheets(strSheetName).Activate
    Sheets(strSheetName).Range("A1").Select
End If
Exit Sub

ErrorRoutine:
    Cancel = True
    MsgBox "The 'Go To Selection' sheet name for your selection needs to be added to sheet 'SheetNames'"

End Sub

Open in new window

0
 

Author Comment

by:Frank Freese
ID: 40335750
My crashes also and I forgot to bring this up.
Thanks
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40335777
Another thing you might want to change in that sub is the error message which I just realized still refers to the "Go To Selection" button we used to have. I would change it to.

   
MsgBox "No worksheet for '" & Target & "' was found in worksheet 'SheetNames'", vbOKOnly + vbExclamation, "Missing Worksheet"

Open in new window

0
 

Author Comment

by:Frank Freese
ID: 40336449
Thanks - great idea
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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