+ Reply to Thread
Results 1 to 3 of 3

Command Button or VBA Code for ascending order of dates

  1. #1
    Registered User
    Join Date
    05-02-2016
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    50

    Command Button or VBA Code for ascending order of dates

    Hi,
    I am trying to set up a command button to reorder the dates inputted in ascending order. I make the button and run a macro but when I hit the command button to run the macro, my header comes into play and it puts the dates above the header line.

    Example:
    Line 1 has a header for my table
    Line 2 starts the information I need have in ascending order by date. Column B is the column date that I would like in ascending order.

    When I plug in dummy numbers on Lines 2 and 3, etc., Lines 2 and 3 get put in ascending order by date but my header gets moved to line 3 (probably because it's not a number, I guess).

    I have attached the worksheet, but I didn't put in my macro as I thought it may add more confusion. Can anyone help me with running a macro with the command button or using a VBA code with the command button.

    I also have the workbook set up to hide the ribbon automatically upon opening. I need this setup still, so you will have to hit "ALT F8" for the ribbon to appear to work with.

    Just a side note item that is bugging me is I have on Line 1 a line that extends along the whole workbook horizontally. I don't know how to get rid of this. It's probably something silly but I haven't figured out what it is. Ughh!

    Thanks so much for your help.
    Lin
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Command Button or VBA Code for ascending order of dates

    Here is some code to attach to a command button

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-02-2016
    Location
    Massachusetts
    MS-Off Ver
    2010
    Posts
    50

    Re: Command Button or VBA Code for ascending order of dates

    Thanks so much for this code. It WORKS! I had to take a day or two and work it out as I had two worksheets to apply it to. I'm sure you probably could have had another vba code to handle this but I wanted to work it out so hopefully I can learn more. I'm sort of new to this. I've been learning from forums and youtube myself. Thanks again!
    Lin

+ 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] Command Button for automatic date ascending order
    By Scrapnforfun in forum Excel General
    Replies: 2
    Last Post: 07-21-2016, 06:07 AM
  2. VB Code to sort the list in ascending order
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2015, 12:08 PM
  3. [SOLVED] Sort dates in ascending order
    By YasserKhalil in forum Excel General
    Replies: 8
    Last Post: 09-18-2015, 06:08 PM
  4. [SOLVED] Sort dates in ascending order of day
    By mso3 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-08-2015, 08:05 AM
  5. [SOLVED] Sort dates in ascending order ignoring the year
    By mukeshbaviskar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2014, 12:30 AM
  6. [SOLVED] VBA Code to Filter dates with command button
    By Angnz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-11-2013, 06:38 AM
  7. Replies: 2
    Last Post: 07-13-2013, 01:10 AM

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