+ Reply to Thread
Results 1 to 2 of 2

Macro to hide both rows and columns simultaneously based on data in cells.

  1. #1
    Registered User
    Join Date
    10-09-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    1

    Macro to hide both rows and columns simultaneously based on data in cells.

    Hi all,

    Apologies, I'm very wet behind the ears with Macro writing and this will probably be a very basic request...I've used a number of forums on this and other sites to get myself so far but I keep hitting snags.

    I have a large matrix filled with 1s and 0s (zeros) referencing the relationships between my column and row headings. I have one column which selects just one row by entry of a "1" (if there is an easier/more intuitive way of selecting one row instead of this, it would be useful to know). Just like an autofilter, my current macro can hide all other rows (the zeros) to just leave me with this one selected row visible and all the remaining columns.

    It's the second part I need help with. In one button press, I want the macro to show the selected row and then hide all columns with a zero leaving me one row with a number of columns remaining (like an autofilter used twice - once in each axis). As a simple example, my aim is to get an output such as Row 276 (my selected row) referencing columns AB, AZ, CR, FZ...etc (the only columns with a "1" entered in that row).

    I've tried re-editing the first (row) code for columns but I'm either not using the right notation or there is a different method. I'm hoping there is one very easy solution that can replace my mess of code! As I said earlier in paragraph 2, it would also be useful to know (if there is) a better row selection method than my current one...

    Thanks!

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to hide both rows and columns simultaneously based on data in cells.

    Why dont you attach a sample file?

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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