+ Reply to Thread
Results 1 to 5 of 5

Dynamic dates in VBA

  1. #1
    Registered User
    Join Date
    04-22-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Thumbs up Dynamic dates in VBA

    Hello everyone, I’m new to the forum and still teething in VBA.
    My spread sheet holds data with input dates recorded. Periodically there is a requirement to remove and copy elsewhere data that is older than 365 days using the Auto Filter. I have a macro that , on first pass, selects the required dates older than 365 days copies and pastes but on the 2nd execution of the macro with a different date required it doesn’t work. Looking at the code the date is not changed. Is there a way around this problem? I am also experiencing a problem finding the next available empty cell in which to copy. I have used serial numbers for dates having first had trouble with dates in dd/mm/yyyy format. I would be grateful for any guidance thank you.
    Attached Files Attached Files
    Last edited by Fairport; 04-23-2009 at 08:09 PM. Reason: Solved

  2. #2
    Registered User
    Join Date
    08-20-2008
    Location
    Philippines
    MS-Off Ver
    Office 2007
    Posts
    18

    Re: Dynamic dates in VBA

    You may want to try this:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-22-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Dynamic dates in VBA

    Thank you Elcaris. Having copied and pasted your example into a new module it halts at
    Please Login or Register  to view this content.
    What do you suggest? Thanks again
    Last edited by VBA Noob; 04-23-2009 at 05:55 PM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Dynamic dates in VBA

    looks like you need sheets named data! and olddata!
    have you changed sheetname olddata! in code to match your sheet name. (or rename your sheet to olddata)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    04-22-2009
    Location
    Liverpool, England
    MS-Off Ver
    Excel 2007
    Posts
    32

    Thumbs up Re: Dynamic dates in VBA

    Thanks martindwilson, could'nt see the wood for the trees!! works a treat now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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