Minute VBA Function – How to get minutes from date and time

Last Updated on January 11, 2023 by token

1. Minute VBA function – Description

The Minute VBA function returns a number representing the minutes for a given date and time. So if we want Excel VBA to return the numbers corresponding to the next minutes, we should use this function. It should be remembered that the date and time from which we want to obtain the number of minutes should be taken from the variable or saved in the VB code in the date format, i.e. YYYY-MM-DD HH24: MI: SS .

2. VBA Minute Function – Syntax

Minute (Time)

Time : The time from which we want to get the next number representing the number of minutes.

Function return: Integer / Numeric value.

3. VBA Minute function – Example

How to use Minute function in VBA Excel? Below is an example of using the Minute function in the VisualBasic Editor.

Sub MinuteFunctionExample ()

MsgBox Minute ("23:58:07")

Dim DatDate As Date
DatDate = Now
MsgBox Minute (DatDate)

MsgBox Minute (Now)

Range ("A1") = Minute ("2017-12-31 23:58:07")

End Sub
Excel VBA functions - Minute VBA function
Excel VBA functions – Minute VBA function

4. VB Minute function – Additional information

  • The Date / Time from which we want to obtain the number of minutes should have the Date data type or be written in the format YYYY-MM-DD HH24: MI: SS.

5. Minute VisualBasic function – Where to use?

The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 365.

The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address: VBA functions .

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: