+ Reply to Thread
Results 1 to 15 of 15

Toggle button show only rows containing todays date and 30 days ahead

  1. #1
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Toggle button show only rows containing todays date and 30 days ahead

    Hi,

    I have googled my fingers sore trying to figure this out but have not found anything. Is there a code I can assign to a toggle button to only show rows with todays date and 30 days ahead?

    The file uploaded is a very easy example of list.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    301

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Hi again @MetteKvidal.
    You did not close your previous topic, but have already opened a new topic. Was your issue resolved in the previous topic?
    NOTE: As the original poster/owner, only you can mark your thread as SOLVED (Thread Tools above Post #1).
    You can say "Thanks" in your thread to everyone who offered to help you.
    You can also reward them by clicking * "Add Reputation" under their username on the left.
    With Regards, MikeVol.

  3. #3
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Hi,

    Yes it was I have marked it as "solved" now. Thanks for reminding me

  4. #4
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    301

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Ok, Try next code for your sample workbook:
    Please Login or Register  to view this content.
    Last edited by MikeVol; 03-26-2024 at 07:45 PM. Reason: Attach the Sample Workbook

  5. #5
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Is there a reason why you would want to hide the rows rather than use a filter?

  6. #6
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by MikeVol View Post
    Ok, Try next code for your sample workbook:
    Please Login or Register  to view this content.
    Thank you for your prompt response.

    I can see the code works perfectly in the attached document except that it also show days from before today. My original text was maybe somewhat not clear about that.

    When implementing the code to my document and changing what I see needs to change to make it work (correct Toggle button, correct name of work sheet and the column containing the dates) it still doesn't work. There are rows in between with blanks, does this effect the code? Also, column A is blank in my sheet.

    "Set rng = ws.Range("B2:B" & ws.Cells(ws.Rows.Count, "A").End(xlUp).Row)" --> I changed this codeline to correct column and start cell. I also tried to change the "A" to "B" with no effect.

    Do you see what might be the reason for it not to work in my document?

    Thank you for your time, it is highly appreciated.

  7. #7
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by ByteMarks View Post
    Is there a reason why you would want to hide the rows rather than use a filter?
    Yes, it is just to make it easier. The document is used in meetings with several people watching when the document is used. So it is just more convenient to use a button instead of all the meeting attendees watching while I use time to filter the next 30 days. The document is used in meetings weekly so the function with the button is something that often will be used.

  8. #8
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    301

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Hello @MetteKvidal!
    Can you make an example file as similar as possible to your original file in structure, without personal data? Attach it to the post, I’ll be next to the computer and take a look at it.
    Perhaps someone else will be able to help you before I get to the computer, times are hard these days. Good luck.

  9. #9
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by MikeVol View Post
    Hello @MetteKvidal!
    Can you make an example file as similar as possible to your original file in structure, without personal data? Attach it to the post, I’ll be next to the computer and take a look at it.
    Perhaps someone else will be able to help you before I get to the computer, times are hard these days. Good luck.
    I sure will. I have attached the file and deleted all information except two columns.

    Thanks again!
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    12-30-2020
    Location
    Odessa / Ukraine
    MS-Off Ver
    2021
    Posts
    301

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Maybe?
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by MikeVol View Post
    Maybe?
    Please Login or Register  to view this content.
    Wow! It worked! I'm amazed :D The worlds cudos to you and everyone else in here that helps people like me. Thank you so very much! Y'all keepin' my love for excel very much alive. <3 Can only hope to be as great as you are one day Thanks again

  12. #12
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by MetteKvidal View Post
    Wow! It worked! I'm amazed :D The worlds cudos to you and everyone else in here that helps people like me. Thank you so very much! Y'all keepin' my love for excel very much alive. <3 Can only hope to be as great as you are one day Thanks again
    Deleted by user and moved to correct reply in thread
    Last edited by MetteKvidal; 03-30-2024 at 08:18 PM.

  13. #13
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Quote Originally Posted by MikeVol View Post
    Maybe?
    Please Login or Register  to view this content.
    Ouch, seems to be a "bug" here. When using this code in Toggle button 3 it works perfectly in sorting out only the next 30 days in column W, but with only one error; when pressing the button again to show all data, row 141 to 181 stays hidden. I have to 'right-click' the rows and press "unhide" to make them appear again. Any idea what may cause this?

    And is there possible to make the appearance of the rows in this button with "sort oldest to newest in column W"? With a reset of this when clicking the button to make all rows appear again? I assume it's a great ask, but to my knowledge, there are so many possibilities in excel, so I don't see any harm in asking you experts

  14. #14
    Registered User
    Join Date
    03-26-2024
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    15

    Re: Toggle button show only rows containing todays date and 30 days ahead

    Would love to close this post and mark it as "solved". Is there anyone that has any idea about my previous post and the "bug"?

    Thanks!

  15. #15
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Toggle button show only rows containing todays date and 30 days ahead

    I think it's because you also have grouping which hides rows. Try adding the highlighted line to expand all the groups before performing the hide/show.

    Please Login or Register  to view this content.

+ 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. Date filter before today plus 2 days ahead
    By glengle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2022, 07:39 PM
  2. Show/Hide Rows & Tabs based on Checked Boxes and Toggle Button
    By Keen1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-30-2020, 10:47 AM
  3. [SOLVED] Marcos to select filter two weeks ahead of todays date plus blanks (and a button!)
    By Moggzy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-06-2020, 10:31 AM
  4. Autohide Columns that are < todays date and > todays date by 2 & 7 days
    By Dropfiddy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-28-2015, 03:51 AM
  5. Show/Hide Rows & Columns Toggle Button
    By axegrynder in forum Excel General
    Replies: 2
    Last Post: 06-29-2015, 06:38 PM
  6. excel formula: days remaining=end date-todays date+extention days
    By fsprings in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-04-2013, 06:45 AM
  7. Excel 2007 : Type date & formulae for 7 days ahead
    By lindalou in forum Excel General
    Replies: 2
    Last Post: 05-02-2009, 12:22 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