Next Sunday Date using VBA Functions

VBA Next Sunday

Next or Next Sunday Date using Excel VBA Functions Now, DateAdd,Format and WeekDay. We have different methods and ways to find Next Sunday date. You can find below three specified macros or procedures to find Next Sunday date using VBA functions. i.e Now, DateAdd, WeekDay and Format.

We are trying to find upcoming or Next Sunday date based on current or today’s date. Lets say today’s date is 8th Dec 2018 and weekday is Saturday then upcoming date of Sunday should be 9th Dec 2018 and weekday is Sunday. In this tutorial we have explained three methods to find Next Sunday date.

Method1: Get Next Sunday Date using VBA Functions

Let us see the first method to find Next Sunday date.

'Method1: Next Sunday Date using Excel VBA Functions
Sub VBA_Find_Next_Sunday_Method1()
    
    'Variable Declaration
    Dim dUComing_Sunday As Date
    
    dUComing_Sunday = DateAdd("d", -Weekday(Now) + 8, Now)

    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    " Next Sunday Date is : " & Format(dNext_Sunday, "DD MMM YYYY"), vbInformation, "Next Sunday Date"
    
End Sub

Method2: Get Next Sunday Date using VBA Functions

Here is the second method to find Next Sunday date.

'Method2: Next Sunday Date using Excel VBA Functions
Sub VBA_Find_Next_Sunday_Method2()
    
    'Variable Declaration
    Dim dUComing_Sunday As Date
    
    dUComing_Sunday = Now + (8 - Weekday(Now))

    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    " Next Sunday Date is : " & Format(dNext_Sunday, "DD MMM YYYY"), vbInformation, "Next Sunday Date"
    
End Sub

Method3: Get Next Sunday Date using VBA Functions

The third method to find Next Sunday date.

'Method3: Next Sunday Date using Excel VBA Functions
Sub VBA_Find_Next_Sunday_Method3()

    Dim dUComing_Sunday As Date
     
    dUComing_Sunday = DateAdd("ww", 1, Now - (Weekday(Now, vbSunday) - 1))
    
    
    MsgBox "If today's date is '" & Format(Now, "DD MMM YYYY") & "' then" & vbCrLf & _
    " Next Sunday Date is : " & Format(dNext_Sunday, "DD MMM YYYY"), vbInformation, "Next Sunday Date"
        
End Sub

Output screenshot: You can find following output screenshot of above specified macros.
Next_Sunday_Date

Instructions to Run VBA Macro Code or Procedure:

You can refer the following link for the step by step instructions.

Instructions to run VBA Macro Code

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays VBA Text Files VBA Tables

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers Blog

Leave a Comment