Adrressing the incorrect worksheet

Posted on 2014-09-21
Last Modified: 2014-09-22
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.
Question by:Frank Freese
  • 4
  • 3
LVL 45

Accepted Solution

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

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

Assisted Solution

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

Author Closing Comment

by:Frank Freese
ID: 40335661
Thank you - I just couldn't see the problem. Everything is ok now.
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

LVL 45

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
        Exit Sub
    End If
    strSheetName = Worksheets("SheetNames").Range("ShowSheet")(intCatFactor + Target.Row + Sheets("ScrollbarData").Range("B2") - 3)

End If
Exit Sub

    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


Author Comment

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

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


Author Comment

by:Frank Freese
ID: 40336449
Thanks - great idea

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Splitting out Data 14 28
Excel 2010 - Text not aligning at bottom of cell! 5 17
Excel 3 22
Rearrange Macro 7 22
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…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now