[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

How can I Filter Rows in a range that already has rows hidden by another process that uses a Variable column for hiding rows?

Asked by jeffreywsmith in Microsoft Excel Spreadsheet Software

Tags: autofiltering, rows

I seem to have a collision between a solution Kevin Jones (zorvek) and Shane Devenshire helped me develop at:

http://www.experts-exchange.com/Applications/MS_Office/Excel/Q_21411490.html
(Solution Title: Looking for a way to embed graphic image so that it is not visible if the row is collapsed in a data outline)

with another solution Kevin and Jim Everist helped me with at:

http://www.experts-exchange.com/Applications/MS_Office/Excel/Q_21427358.html
(Solution Title: Pictures Formatted with "Move and size with cells" do NOT resize when the Row Height changes)

and another filtering sub sub I am trying to implement on the same worksheet (ShowUnusedOnly_ShowALL - I'll post below). It runs from a command button and should just toggle to either: A) filter Column C (with the Column header in C11) with a criteria of "0" and display the results or B) turn the filter off if it was on (to ShowAll), but WITHOUT unhiding rows hidden by another procedure.  The issue I am having is I have to find a way to consider BOTH the criteria in this column and the criteria in the VBA-defined name variable range "KeyRangeName" developed in the HideRows sub (which basically references a variable column of data in the spreadsheet, looking for a "1" as a row marker for rows to be displayed).  

With an eye towards trying to set up an AutoFilter on both the values in C12:C197 AND the same corresponding Rows in the column represented by the KeyRangeName, I tried making KeyRangeName a Public variable at the top of the ThisWorkbook module (but then got a "Compile Error: Variable not defined" on KeyRangeName in HideRows (even though it was declared as Public …), so I then tried (in HideRows) assigning KeyRangeName to a new Public variable "MyKeyRangeName" and leaving KeyRangeName as a Private variable … but that also gave me a "Compile Error: Variable not defined" on KeyRangeName, this time on "MyKeyRangeName" in HideRows, even though it was declared a Public variable at the top of the ThisWorkbook module.  I don't know why that's happening - if a variable is declared as Public, why would I get these errors?

By the way, if it is useful, there is dynamically determined range called "Usage", that represents the range of cells of interest in Column C - defined as:

Usage =OFFSET('Usage Report'!$C$12,0,0,COUNTA('Usage Report'!$C$12:$C$197),1)

I also can't seem to figure out how to set up these AutoFilter tests, especially when they involve criteria in a second column whose location is variable (depending upon the factors used to construct KeyRangeName in HideRows …)

BTW, the variable column referred to by KeyNameRange is normally hidden by virtue of a collapsed Data Outline (and I will probably supress the display of the Data Outline Symbols in the finished product ... so if either the column has to be visible (and/or the Data Outline Symbols have to be visible to make a hidden column visible) in order for the AutoFilters to work, I'll need to take that into account, too ...

In sum, the user should not have to be concerned with the rows hidden by HideRows (those are automatically determined by Excel version and screen resolution and the rows hidden by that process should not be displayed when the ShowUnusedOnly_ShowALL procedure finishes). So, there really is only 1 "Filtering" operation that needs to be performed:  either A) show All rows applicable to their Excel version and screen resolution, or show only those with a "0" in C12:C197 (with both NOT showing rows NOT applicable to their Excel version and screen resolution as determined in HideRows).  

Hope this is clear and someone can help me see the forest for the trees …

Jeff

code follows (I have left as commented out some of the variations I have been trying but none worked):

in ThisWorkbook module:

Public MyKeyRangeName As String  ' For ShowUnusedOnly_ShowAll (Usage Report module)
' Public KeyRangeName As String  ' For ShowUnusedOnly_ShowAll (Usage Report module)

in Sheet3(Usage Report) module:

Public Sub HideRows()

' With assistance from Kevin Jones and Shane Devenshire at:
' http://www.experts-exchange.com/Applications/MS_Office/Excel/Q_21411490.html

Const SM_CXSCREEN = 0       ' Initialize horizontal screen resolution metric
   
Dim z As Variant            ' Variable for horizontal screen resolution metric (in pixels)
Dim X As String             ' Trimmed version of screen resolution variable z
Dim W As String             ' Right 3 characters of X
Dim Key As String           ' Variable to build key name
Dim KeyRangeName As String  ' Complete Variable name
Dim cell As Range

' Declare Range names for 21 possible configurations - these names will match pre-defined
' Range names in the ws, representing columns of row markers for all 21 configuations
' (although only 1 is used in the ActiveWorkbook.Names(KeyRangeName).RefersToRange property)

Dim DS2800_ As Range
Dim DS2856_ As Range
Dim DS2024_ As Range
Dim DS2152_ As Range
Dim DS2280_ As Range
Dim DS2400_ As Range
Dim DS2600_ As Range
Dim DSX800_ As Range
Dim DSX856_ As Range
Dim DSX024_ As Range
Dim DSX152_ As Range
Dim DSX280_ As Range
Dim DSX400_ As Range
Dim DSX600_ As Range
Dim DS3800_ As Range
Dim DS3856_ As Range
Dim DS3024_ As Range
Dim DS3152_ As Range
Dim DS3280_ As Range
Dim DS3400_ As Range
Dim DS3600_ As Range
   
z = GetSystemMetrics(SM_CXSCREEN)     ' API call to get screen resolution in pixels
X = Trim(z)                           ' To trim leading and trailing spaces in z
W = Right(X, 3)                       ' Right 3 characters of X
   
    If Application.Version = 9 Then
        Key = "DS2"
    ElseIf Application.Version = 10 Then
        Key = "DSX"
    ElseIf Application.Version > 10 Then
        Key = "DS3"
    End If

    KeyRangeName = Key & Right(X, 3) & "_"
   
    MyKeyRangeName = KeyRangeName
   
    For Each cell In ActiveWorkbook.Names(KeyRangeName).RefersToRange
   
       If cell = 1 Then
       
           cell.EntireRow.Hidden = False
           
       Else
       
           cell.EntireRow.Hidden = True
           
       End If
       
    Next cell
 
End Sub

Sub ShowUnusedOnly_ShowAll()

Dim CalculationSave As Long

CalculationSave = Application.Calculation
Application.Calculation = xlManual
Application.ScreenUpdating = False
   
Range("C11").Select

'If ActiveSheet.FilterMode = True Then

With ActiveSheet

    If .AutoFilterMode Then
   
        With .AutoFilter.Filters(3)
       
            If .On Then
           
                GoTo TurnOFF  
               
            Else
           
                GoTo TurnON
               
            End If
               
        End With
       
    Else
   
        GoTo TurnON
   
    End If
   
End With

'If Selection.AutoFilter(Field:=3, Criteria1:="0") = True Then

TurnOFF:

    ActiveSheet.ShowAllData
   
    HideRows             ' Hide rows not applicable to this configuration

    Selection.AutoFilter ' Turns Off AutoFilter Drop-down arrows

'Else
   
TurnON:

'    Selection.AutoFilter Field:=3, Criteria1:="0", VisibleDropDown:=False

    Selection.AutoFilter Field:="Usage", Criteria1:="0", Field:="KeyRangeName", Criteria2:="1", VisibleDropDown:=False

    HideRows
   
'End If
   
Application.Calculation = CalculationSave
Application.ScreenUpdating = True
   
End Sub
 
Related Solutions
Keywords: How can I Filter Rows in a range that a…
 
Loading Advertisement...
 
[+][-]05/19/05 10:41 PM, ID: 14043192Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: autofiltering, rows
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 2
Solution Grade: A
 
[+][-]05/19/05 02:34 PM, ID: 14040825Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 02:38 PM, ID: 14040850Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/19/05 02:39 PM, ID: 14040855Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 03:09 PM, ID: 14041042Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 03:17 PM, ID: 14041097Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 03:18 PM, ID: 14041100Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 03:24 PM, ID: 14041145Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 03:27 PM, ID: 14041167Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 03:28 PM, ID: 14041172Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 03:33 PM, ID: 14041198Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 03:42 PM, ID: 14041239Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 04:15 PM, ID: 14041383Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 04:50 PM, ID: 14041495Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 05:23 PM, ID: 14041636Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 05:38 PM, ID: 14041943Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 05:45 PM, ID: 14042087Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 05:48 PM, ID: 14042106Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 05:50 PM, ID: 14042130Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 05:57 PM, ID: 14042162Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 05:57 PM, ID: 14042166Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 06:02 PM, ID: 14042181Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/19/05 06:08 PM, ID: 14042205Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 06:10 PM, ID: 14042218Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 06:23 PM, ID: 14042304Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 06:44 PM, ID: 14042439Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 09:28 PM, ID: 14042985Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/19/05 10:20 PM, ID: 14043140Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05/20/05 11:02 AM, ID: 14047650Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/20/05 11:33 AM, ID: 14047890Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/20/05 11:59 AM, ID: 14048081Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/20/05 12:10 PM, ID: 14048163Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/20/05 12:15 PM, ID: 14048191Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/20/05 12:18 PM, ID: 14048213Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92