+ Reply to Thread
Results 1 to 2 of 2

Need to Create Macro Button That Hides Empty Columns ONLY when Rows are Filtered

  1. #1
    Registered User
    Join Date
    03-27-2019
    Location
    Moorpark, CA
    MS-Off Ver
    Microsoft Office 365
    Posts
    1

    Need to Create Macro Button That Hides Empty Columns ONLY when Rows are Filtered

    Hello everyone!

    I am relatively new to VBA / macro coding so I am in desperate need of your help!

    I have a spreadsheet showing product SKU's, their everyday retail price and the promo price they had during specific promotions. There are a lot of empty columns because not every product is included in every promotion. I have added a command button in the top right corner of the sheet that is titled Hide / Unhide Blank Columns.

    My goal is that when the command button is clicked, ONLY the blank promotion price columns will be hidden (not deleted, just hidden).

    This is what the spreadsheet looks like with no filters:

    When the data is filtered to show only 1 SKU at a time, I need the button to hide the empty columns (essentially go from FIGURE 2 to FIGURE 3)


    The current coding I have linked to the command button is as follows:

    Please Login or Register  to view this content.

    Any feedback you have would be greatly appreciated!

    ~ Ashley
    Last edited by asoule519; 03-28-2019 at 12:28 PM. Reason: Please use code tags when posting code!

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Need to Create Macro Button That Hides Empty Columns ONLY when Rows are Filtered

    Hello Ashley and welcome to the forum.
    It will always help your query if you include the spreadsheet / workbook that you are trying to "manipulate". Most of us are "time poor" and unless the solution is very very obvious we don't have the time to build a spreadsheet to investigate possible solutions.

    Forum members are generally very helpful and often extremely knowledgeable in all manner of excel / VBA solutions.

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

+ 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. [SOLVED] Macro hides rows on button press but other Functions referenced then display ERROR message
    By dougielb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2015, 09:32 AM
  2. Clunky Slow Code, Hides Empty Rows, Takes too long...
    By BoSonic in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2013, 08:56 PM
  3. [SOLVED] Worksheet Macro that hides empty rows does not work
    By Taktiker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-22-2012, 11:11 AM
  4. Macro command button to hide empty rows
    By djauncey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-31-2012, 10:42 AM
  5. Macro Button to delete all rows that are empty
    By timmyjc18 in forum Excel General
    Replies: 3
    Last Post: 06-22-2012, 09:38 PM
  6. [SOLVED] URGENT!! Use macro button to hide empty columns and rows...HELP!!!!
    By Hawk in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-08-2005, 06:05 PM
  7. Button hides unhides columns, how?
    By JimH in forum Excel General
    Replies: 3
    Last Post: 04-20-2005, 05:06 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