Current Tuesday Date of This Week using VBA Functions

VBA Current Tuesday

Current Tuesday Date:

Current Tuesday Date using Excel VBA Functions Now, DateAdd,Format and WeekDay. We have different methods and ways to find Current Week Tuesday date. You can find below two specified macros or procedures to find Current week Tuesday date of this week using VBA functions. i.e Date, DateAdd, WeekDay and Format.

We are trying to find current week Tuesday date based on currnt or today’s date. Lets say today’s date is 13th Dec 2018 and weekday is Thursday then current date of Tuesday should be 11th Dec 2018 and weekday is Tuesday. In this tutorial we have explained three methods to find Current week Tuesday date. To avoid using time, you can replace Date with Now. Then there is no difference in output.

Method1: Get Current Week Tuesday Date using VBA Functions

Let us see the first method to find current week Tuesday date of this week.

'Method 1: Current Tuesday Date using Excel VBA Functions
Sub VBA_Find_Current_Tuesday_Method1()
    
    Dim dCurrent_Tuesday As Date

    dCurrent_Tuesday = DateAdd("d", 1 - Weekday(Date, vbTuesday), Date)

    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    "Current Tuesday Date is : " & Format(dCurrent_Tuesday, "DD MMM YYYY"), vbInformation, "Current Week Tuesday Date"
    
End Sub

Method2: Get Current Week Tuesday Date using VBA Functions

Here is the second method to find Current week Tuesday date of this week.

'Method 2: Current Tuesday Date using Excel VBA Functions
Sub VBA_Find_Current_Tuesday_Method2()
    
    'Variable Declaration
    Dim dCurrent_Tuesday As Date
    
    dCurrent_Tuesday = Date - Weekday(Date, vbTuesday) + 1

    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    " Current Tuesday Date is : " & Format(dCurrent_Tuesday, "DD MMM YYYY"), vbInformation, "Current week Tuesday Date"
    
End Sub

Method3: Get Current Week Tuesday Date using VBA Functions

Let us see the third method to find Current week Tuesday date of this week.

'Method 3: Current Tuesday Date using Excel VBA Functions
Sub VBA_Find_Current_Tuesday_Method3()
    
    'Variable Declaration
    Dim dCurrent_Tuesday As Date
    
    dCurrent_Tuesday = 3 - Weekday(Date) + Date

    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    " Current Tuesday Date is : " & Format(dCurrent_Tuesday, "DD MMM YYYY"), vbInformation, "Current Week Tuesday Date"
    
End Sub

Output Screenshot

You can find following output screenshot of above specified macros.
Current Tuesday Date

Instructions:

  • Open Visual Basic Editor by clicking Alt +F11
  • Goto code window by clicking F7
  • Copy any of the above specified procedure or macro
  • Paste above copied code in code window
  • Run macro by clicking F5 or Run command
  • You can see ouput on the screen
  • Find specified output screenshot above.

Related VBA Functions used in this article:

We have used DateAdd, Now, Weekday and Format VBA functions. Click on below specified links to learn more about VBA functions.

VBA DateAdd Function VBA Date Function VBA WeekDay Function VBA Format Function




Leave a Comment

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