+ Reply to Thread
Results 1 to 3 of 3

Code to unhide rows and columns based on selections

  1. #1
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Code to unhide rows and columns based on selections

    Hi, I am try to add to a code that I already have in my workbook (see below).

    I have multiple sheets in a workbook and I am using data validation drop lists to allow the user to select criteria to open the correct worksheet where the required information is stored. The code below does this for me. I want to add code once the appropriate sheet is visible, where certain columns and rows within that spreadsheet are highlighted (it is a large worksheet with multiple rows/ columns). My thought would be that all rows and columns are hidden (except header rows) and have a code to unhide rows and columns that pertain to the selection. For example, for list1 = "Choice1" And list2 = "ChoiceA" And list3 = "Item1" Then Sheets("Sheet1").Visible = True, maybe these selections I would want to unhide columns D through R and rows 3 - 80. The user can print out that information as needed. Then the rows/ columns need to be hidden again in preparation for the next selection. For example, ElseIf list1 = "Choice2" And list2 = "ChoiceB" And list3 = "Item2" Then Sheets("Sheet1").Visible = True, maybe columns Q thro T and rows 81 thru 100 need to be visible.

    Any suggestions? Thanks


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Code to unhide rows and columns based on selections

    You can use the .Hidden property to hide or unhide a range. However, you can only hide entirerows or entirecolumns not portions of both: For example:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Re: Code to unhide rows and columns based on selections

    thank you!

+ 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. Vb code to hide/unhide rows based on entries on another sheet
    By tcrjmom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2015, 01:15 PM
  2. Replies: 1
    Last Post: 08-29-2014, 10:38 AM
  3. Need code to hide and unhide a row based on if other rows are hidden or unhidden
    By aradov in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-20-2014, 02:06 PM
  4. Need to Hide/Unhide Rows and Columns Based on Several Date Ranges
    By zlorinc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 04:32 PM
  5. [SOLVED] Checkbox VBA - Hide/Unhide Rows and/or Columns based on cell values
    By gravy258 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-21-2013, 05:39 PM
  6. [SOLVED] How VB code can unhide/hide rows based on combobox selection?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2012, 01:25 PM
  7. VBA code to unhide X number of rows based on a number entered into a cell above
    By gazza365 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2010, 08:48 PM

Tags for this Thread

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