Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-21-2017, 04:42 AM
StephenRay StephenRay is offline Fifteen Days From Today's Date, (Not Counting Saturday & Sunday). Windows 7 64bit Fifteen Days From Today's Date, (Not Counting Saturday & Sunday). Office 2010 64bit
Advanced Beginner
Fifteen Days From Today's Date, (Not Counting Saturday & Sunday).
 
Join Date: Jan 2012
Location: Overland Park, Kansas
Posts: 53
StephenRay is on a distinguished road
Default Fifteen Days From Today's Date, (Not Counting Saturday & Sunday).

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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fifteen Days From Today's Date, (Not Counting Saturday &amp; Sunday). Counting the difference in days within multiple groups 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft