search
HomeTopicsexcelDetailed example of using Excel to create countdown cards

This article brings you relevant knowledge about excel, which mainly introduces the relevant content about zenmm making countdown cards, using the date function in Excel combined with the VBA code to refresh according to the specified time , you can create a countdown card. Let’s take a look at it. I hope it will be helpful to everyone.

Detailed example of using Excel to create countdown cards

Related learning recommendations: excel tutorial

Make a countdown card in Excel, let’s see the effect first:

Detailed example of using Excel to create countdown cards

In daily work, there are often some countdown applications, such as the common ones of n days until the college entrance examination, n days until the end of the project, etc. Use the date function in Excel combined with the VBA code to refresh according to the specified time to create a countdown card.

Step 1 Assume that the holiday end date is 0:00 on December 27, 2021, enter the following formula in cell C2 to get the remaining integer days.

=INT("2021-12-27"-NOW())&"Day"

Step 2 Set the custom format of D2 cell to:

hh hour mm minutes ss seconds

Detailed example of using Excel to create countdown cards

Then enter the following formula in cell D2:

="2021-12-27"-NOW()

Although the NOW function is a volatile function, if no operation is performed in the worksheet that can cause recalculation, the formula results cannot be automatically refreshed in real time, so VBA code for scheduled refresh needs to be added.

Step 3 Press the key combination to open the VBE editor, click the [Insert] → [Module] command, and click in the [Project Explorer] to select the "Module 1" just inserted. ”, enter the following code in the code window on the right.

Sub Macro1()
Application.OnTime Now + TimeValue("00:00:01"),"Macro1"
Calculate
End Sub
Private Sub workbook_open()
Macro1
End Sub

Detailed example of using Excel to create countdown cards

The "00:00:01" in the code means that the refresh time is 1 second, which can be set as needed in actual use. For example, if you want to set the refresh time to 1 minute, you can modify this part to "00:01:00".

Step 4 Click to select "ThisWorkbook" in [Project Explorer], enter the following code in the code window on the right, and then press the F5 key to achieve the countdown effect in the cell.

Private Sub workbook_open()
Call Macro1
End Sub

Detailed example of using Excel to create countdown cards

Finally save the file as an Excel macro-enabled workbook, that is, xlsm format.

When you open the file again, if a security warning appears as shown in the figure, remember to click the [Enable Content] button.

Detailed example of using Excel to create countdown cards

After the production is completed, you can open Excel and watch the time decrease little by little, while the longing for someone in your heart becomes stronger and stronger...

Related learning recommendations: excel tutorial

The above is the detailed content of Detailed example of using Excel to create countdown cards. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Excel Home. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software