![]() |
#1
|
|||
|
|||
![]()
I am just starting to learn VBA. I have a good book, and I search the 'net for examples to go by.
Ultimately, I want a Macro to add fifteen week-days to the current date and display the date in this format: 07-21-2017. -Not including Saturday and Sunday. But I am stuck with a compile error. It says "Object Required" and it highlights: Set iCounter = 0 All the examples I have seen make the counter an integer, and I have studied data objects. But can you make an object an integer? Here's what I have written so far: Sub Macro4() ' ' Macro4 Macro ' ' Dim fifteenDaysFromNow As Date Dim iCounter As Integer 'This next line is highlighted with the compile error Set iCounter = 0 Dim day As DayOfWeek Set DayOfWeek = currentDateTime.DayOfWeek Do fifteenDaysFromNow = DateAdd("d", 1, Date) If day = DayOfWeek.Saturday Or day = DayOfWeek.Sunday Then iCounter = -1 Else iCounter = +1 Loop While iCounter <= 16 End If End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
wheddingsjr | Excel | 2 | 03-28-2017 07:38 AM |
Sum Function over Today +/- 60 Days | gabeha | Excel | 2 | 09-12-2014 01:13 AM |
Using Outlook Today Calendar Days | cwksr | Outlook | 0 | 08-13-2014 10:57 AM |
Conditional formatting of Today +21 days? | SHERMAN | Excel | 3 | 12-20-2010 08:08 AM |
Creating an Auto-Calc'd Date? Today+7 Days? | SoCalTelephone | Word | 0 | 10-06-2010 10:27 AM |