+ Reply to Thread
Results 1 to 10 of 10

Hiding rows by time

  1. #1
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    Office Pro 2010
    Posts
    275

    Hiding rows by time

    Hi Guys

    This is a follow on from a previous post

    https://www.excelforum.com/excel-pro...ml#post5337419

    I need to add a time variant into this macro if possible or add a new macro that does whats required

    What im trying to do is for the macro to look at the current time, add 4 hours and then hide all previous lines before that time so as in the example if the time was 14:08 it needs to hide all rows prior (A1-A6)

    (im aware the sample ive uploaded hasnt a macro set but the link above has all needed detail)
    Attached Files Attached Files

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Hiding rows by time

    Try...
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    Office Pro 2010
    Posts
    275

    Re: Hiding rows by time

    Thank you for your input its definetly helped me point in the right direction, but i still cant get it to run correctly. When it does run it hides on the wrong tab and only goes as far as 286 lines or 615

    Ive tried tinkering to no avail. Below is where im trying to get it to look at for the date/time which is on tab 2, Column A, from A7 to A8000

    Please Login or Register  to view this content.
    Last edited by ukphoenix; 06-06-2020 at 12:07 PM.

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Hiding rows by time

    Added a bit of error checking...
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    Office Pro 2010
    Posts
    275

    Re: Hiding rows by time

    OK tried that but debugs out on 'Set rg' line, I know this is where I need it to point to as its used in another macro for another tab, i just changed the worksheet name.
    Anything you can do to educate me on whats pointing where would be appreciated as I am a pure novice trying to learn

    Attachment 681311
    Attachment 681312

  6. #6
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Hiding rows by time

    Your attachments aren't viewable...


    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  7. #7
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    Office Pro 2010
    Posts
    275

    Re: Hiding rows by time

    sorry they were just screen shots of the code we've previously looked at but will put code down now

    OK tried that but debugs out on 'Set rg' line, I know this is where I need it to point to as its used in another macro for another tab, i just changed the worksheet name.
    Anything you can do to educate me on whats pointing where would be appreciated as I am a pure novice trying to learn

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Hiding rows by time

    Lets try changing the variable name...
    Please Login or Register  to view this content.
    If it still errors, I'll need to know the line of code and the error message.

  9. #9
    Forum Contributor
    Join Date
    03-23-2007
    Location
    Essex, UK
    MS-Off Ver
    Office Pro 2010
    Posts
    275

    Re: Hiding rows by time

    No go still debugs on the same line

    Set rgA = Workbooks("WS Template.xlsm").Worksheets("2.Update pivot").Range("A7:A7999")

    im gonna have to look more closely at the address I think. Thanks for attempting resolution. Ofcourse if you come up with any other ideas please post

  10. #10
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Hiding rows by time

    Is Workbooks("WS Template.xlsm") open when you run this code?
    Does the worksheet have protection enabled?

    Without knowing the error, I would also check that the name of the workbook and the name of the worksheet are exactly the same as written in the code.

+ 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. Rows appear to be hiding and un-hiding themselves
    By chrisellis250 in forum Excel General
    Replies: 2
    Last Post: 08-18-2016, 07:37 AM
  2. [SOLVED] hiding/marking many rows at the same time?
    By mariemm in forum Excel General
    Replies: 4
    Last Post: 07-23-2012, 08:34 AM
  3. Hiding a button when hiding rows
    By fergusor in forum Excel General
    Replies: 2
    Last Post: 08-10-2006, 09:31 AM
  4. Replies: 4
    Last Post: 08-09-2006, 02:19 PM
  5. [SOLVED] Hiding Rows & Tabs at the same time
    By * Kenneth * in forum Excel General
    Replies: 0
    Last Post: 03-29-2006, 03:10 PM
  6. Replies: 2
    Last Post: 10-18-2005, 10:05 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