+ Reply to Thread
Results 1 to 4 of 4

Command Button Countdown

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    235

    Command Button Countdown

    Hi All,

    I am trying to make a command button count down and show the numbers as its counting down.
    I can make it show a starting number and its final number but not the numbers in between.

    Here is the code at present

    Private Sub CommandButton8_Click()
    
    Dim i As Integer
    
    If Date <= CDate("06/04/" & Year(Date)) Then
    Me.TextBox2.Value = "06/04/" & Year(Date) - 1
    Me.TextBox3.Value = "05/04/" & Year(Date)
    Me.CommandButton1.Caption = "> > >  Apply Dates  < < <"
    Me.Controls("CommandButton1").BackColor = &H8080FF
    
    Else
    
    Me.TextBox2.Value = "06/04/" & Year(Date)
    Me.TextBox3.Value = "05/04/" & Year(Date) + 1
    Me.CommandButton1.Caption = "> > >  Apply Dates  < < <"
    Me.Controls("CommandButton1").BackColor = &H8080FF
    
    For i = 5 To 1 Step -1
    Me.CommandButton1.Caption = "> > >  " & i & "  < < <"
    Application.Wait Now + TimeSerial(0, 0, 1)
    Next i
    
    End If
    
    End Sub
    Also when it gets to 1 then automatically presses CommandButton1.

    Any help is much appreciated.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Command Button Countdown

    Me.Repaint or DoEvents
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Forum Contributor
    Join Date
    11-23-2004
    Location
    Bristol
    MS-Off Ver
    2016
    Posts
    235

    Re: Command Button Countdown

    It only went and worked - you star.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,606

    Re: Command Button Countdown

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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. Countdown after button click
    By kovacsdev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2016, 04:56 AM
  2. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  3. Insert Command Button that will Activate Command Button on a Different Sheet
    By realvirtuality1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2016, 02:11 PM
  4. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  5. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  6. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  7. Replies: 0
    Last Post: 11-03-2005, 11:00 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