+ Reply to Thread
Results 1 to 5 of 5

Hiding Cells...

Hybrid View

  1. #1
    Registered User
    Join Date
    06-03-2016
    Location
    Holland, MI
    MS-Off Ver
    Excel 2010
    Posts
    3

    Hiding Cells...

    Hello All,

    I am relatively new to Excel beyond very basic formulas and I wanted to see if you guys could help me get what seems like a fairly easy question answered. (I stole the current formulas from what a previous manager used for a different sheet if you're curious as to how I even got to the point I did). What I have now is the far Lane in the "Data" sheet coordinating to the "Cooler Outline" sheet. When I put a number in the "Lane #" column it shows up with the desired information in the "Cooler Outline." My only problem is all the blanks. I'd love to have it so any of the empty rows or even columns that aren't filled get sorted out. I tried to use a table to do this but the way the info is I couldn't figure how to do this... All the info I tried to pull had me deleting blanks or trying to get rid of every blank one but the work space. Any help is appreciated!

    Best,
    Jake
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Hiding Cells...

    I attacked this problem with pivot tables.

    First I converted the data on the data sheet to an Excel table and I added a helper column that checks to see if the Lane # cell is blank.

    I then used this table as the data source for the pivot table on the Pivot 1 sheet. This pivot table gets the lane number, quantity, customer and comp where the lane number is not blank.

    I then used this pivot table as a data source for a second pivot table. First I had to overlay it with a named dynamic range: Lane_Data =OFFSET('Pivot 1'!$A$3,0,0,COUNTA('Pivot 1'!$A:$A)-1,4).

    Then I could use Lane_Data as the source for the second pivot table.

    To get an understanding of named dynamic ranges, see this article: http://www.utteraccess.com/wiki/inde...Dynamic_Ranges.

    The second pivot table takes the right data (on Pivot 1) and formats it into the right format (on Pivot 2).
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    06-03-2016
    Location
    Holland, MI
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Hiding Cells...

    Thanks for your help dflack! But I'd really like the info to work in the Cooler Outline Sheet, rather than have two other sheets. Is this possible? All I need is to be able to hide the unused cells and columns in Cooler Outline.

    Thanks again!
    Jake

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Hiding Cells...

    Well, if you insist .
    Option Explicit
    
    Public Sub HideCells()
    Dim sh As Worksheet
    Dim i As Long
    Dim j As Long
    Dim CountRange As Range
    
    ' initialize variables
    Application.ScreenUpdating = False
    
    Set sh = Sheets("cooler outilne")
    
    'Unhide all rows and columns
    sh.Cells.EntireRow.Hidden = False
    sh.Cells.EntireColumn.Hidden = False
    
    ' Hide rows with no data
    For i = 5 To 141
        Set CountRange = sh.Range(sh.Cells(i, "B"), sh.Cells(i, "BU"))
        If Count_Range(CountRange) = False Then
            CountRange.EntireRow.Hidden = True
        End If
    Next
    
    For j = 2 To 73
        Set CountRange = sh.Range(sh.Cells(5, j), sh.Cells(141, j))
     
        If Count_Range(CountRange) = False Then
            CountRange.EntireColumn.Hidden = True
        End If
    Next
       
    Application.ScreenUpdating = True
    End Sub
    
    Public Function Count_Range(MyRange As Range) As Boolean
    Dim bRtn As Boolean
    Dim cl As Range
    
    bRtn = False
    
    For Each cl In MyRange
        If Len(cl.Value) > 0 Then
            bRtn = True
            Exit For
        End If
    Next
    
    Count_Range = bRtn
    End Function

  5. #5
    Registered User
    Join Date
    06-03-2016
    Location
    Holland, MI
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Hiding Cells...

    Still trying to figure out how to do this?

+ 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. Hiding Cells
    By tubaplaya in forum Excel General
    Replies: 2
    Last Post: 11-16-2013, 07:24 PM
  2. Hiding Cells
    By Sauc in forum Excel General
    Replies: 1
    Last Post: 11-21-2011, 11:57 PM
  3. Hiding Cells
    By Azzheasman in forum Excel General
    Replies: 11
    Last Post: 01-31-2011, 11:15 AM
  4. Hiding Cells
    By Shadow-Walker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2008, 02:29 AM
  5. hiding cells
    By franbarb in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 06-28-2006, 09:10 PM
  6. Hiding Cells
    By Chris in forum Excel General
    Replies: 5
    Last Post: 06-20-2006, 02:10 PM
  7. Hiding Cells
    By egiro25 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-21-2005, 12:05 AM
  8. hiding cells to move cells with values together
    By tuud718 in forum Excel General
    Replies: 0
    Last Post: 04-13-2005, 04:44 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