+ Reply to Thread
Results 1 to 7 of 7

Macro to display specific cells

  1. #1
    Registered User
    Join Date
    04-03-2017
    Location
    Germany
    MS-Off Ver
    MS Office 2013
    Posts
    36

    Macro to display specific cells

    Hi all,

    please see attached my sample file. I need a button below the table, which I can use to display specific cells in the table. Meaning that when I click the button for the first time, the cells C4:F4 shall be displayed. The rest of the cells with a %-value have to be blank. When I click the button the second time, the cells C4:F5 shall be displayed and again the rest blank. The same for period 3 and 4. When I click the button for the 5th time and all clicks after that, all the cells should be displayed.

    Can someone help me with that? That would be awesome.
    Attached Files Attached Files

  2. #2
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Macro to display specific cells

    Hi Superlan-Have you ever worked with Filtering (Filter on the Data tab)? It may fit your needs.
    PS You may want to consider switching your columns and rows, since there are probably more stocks than periods.
    Last edited by leelnich; 01-31-2018 at 05:46 PM.
    Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
    Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee

  3. #3
    Registered User
    Join Date
    04-03-2017
    Location
    Germany
    MS-Off Ver
    MS Office 2013
    Posts
    36

    Re: Macro to display specific cells

    Hi leelnich, my actual file consists of the exact same amount of columns and rows, so 4 stocks (columns) and 5 periods (rows). Filtering data would not help in that case unfortunately, I have to do it as explained above...

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Macro to display specific cells

    OK. The nice thing about filtering is that the data is un-affected, it just hides the rows. Do you want to start with hidden rows and just expose them, or do you actually need to add data to previously-blank cells. If so, where does the data come from?

  5. #5
    Registered User
    Join Date
    04-03-2017
    Location
    Germany
    MS-Off Ver
    MS Office 2013
    Posts
    36

    Re: Macro to display specific cells

    The thing is that my data is connected to a chart and I only want to display the data for period 1 in the chart when I click on the button, then click again for period 2 so that the chart updates. Since I need the chart to be updated from time to time, I cannot just hide the data, because then the chart would still be drawn with all the data which is in the table, even though it's hidden.

    Hence, I need to add data to previously-blank cells. If there is a way to still keep it to 1 table then this would be great. Otherwise maybe a solution would be to create another table with all the data, make the original one blank, and just pick the data from the created table?

    Or maybe you know a better way to do it? Thanks for your help!

  6. #6
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Macro to display specific cells

    Sorry, I have to go, but you might check out these links. The general idea is to use easily - or even automatically - changeable named ranges for your data series. I'll check back tommorrow:
    Dynamic Charts
    VBA-to-filter-chart-data-range/
    Automatic-updating-dynamic-charts

  7. #7
    Registered User
    Join Date
    04-03-2017
    Location
    Germany
    MS-Off Ver
    MS Office 2013
    Posts
    36

    Re: Macro to display specific cells

    Ok so maybe it works then without a macro but with just changeable named ranges for your data series. I have attached a new example with a chart. Can you tell me how to do it with this chart, including the mentioned button I need to click on? Thanks!
    Attached Files Attached Files

+ 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. Display specific values based on data from other cells
    By michaelb46 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-24-2017, 05:01 PM
  2. Display comments in specific range of cells
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-29-2015, 09:05 PM
  3. Replies: 6
    Last Post: 05-14-2014, 04:56 PM
  4. [SOLVED] Macro to copy specific data from one WB to specific cells in another WB based on specific
    By d_rose in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2014, 11:05 AM
  5. Replies: 4
    Last Post: 07-25-2010, 04:21 PM
  6. Copy specific cells in a row to an array and then display them
    By Macster in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2009, 09:17 AM
  7. Display contents of a specific cell even if a group of cells is mo
    By Larry Heine in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-03-2005, 04:06 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