Return to VBA Code Examples

VBA Second Function

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021

Second Description

Returns the second component of a supplied time.

Simple Second Examples

Here is a simple Second example:

Sub Second_Example()
    MsgBox Second(#1:30:25 AM#)
End Sub

This code will return 25.

Second Syntax

In the VBA Editor, you can type¬† “Second(” to see the syntax for the Second Function:

The Second function contains an argument:

Time: A valid time.

Examples of Excel VBA Second Function

MsgBox Second("1/1/2019 1:30:20 PM")

Result: 20

MsgBox Second(#8/14/2019 5:12:15 PM#)

Result: 15

MsgBox Second("1:30:35 AM")

Result: 35

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as

Learn More!

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples