vba word - excluding weekends

kobie

New Member
Joined
Jun 19, 2009
Messages
15
Hi everyone! I havent had to use th forum in a whhile but here-goes:

I am creating a dropdown to dictate a return date. Here is my code:

Private Sub cboSelectAttempts_Change()
If cboSelectAttempts.ListIndex = 0 Then
txtFlup.Text = Format(Now + 4, "mm/dd/yyyy")
cboSelectAttempts.SetFocus
End If


If cboSelectAttempts.ListIndex = 1 Then
txtFlup.Text = Format(Now + 4, "mm/dd/yyyy")
txtBtn.SetFocus
End If



If cboSelectAttempts.ListIndex = 2 Then
txtFlup.Text = Format(Now + 3, "mm/dd/yyyy")
txtBtn.SetFocus
End If



If cboSelectAttempts.ListIndex = 3 Then
txtFlup.Text = Format(Now + 2, "mm/dd/yyyy")
txtBtn.SetFocus
End If



If cboSelectAttempts.ListIndex = 4 Then
txtFlup.Text = Format(Now + 1, "mm/dd/yyyy")
txtBtn.SetFocus
End If



If cboSelectAttempts.ListIndex = 5 Then
txtFlup.Text = Format(Now + 1, "mm/dd/yyyy")
txtBtn.SetFocus
End If

End Sub

I am wanting "txtFlup.Text" to return the date specified but i want to exclude weekends.

Anyone's help is appreciated!!

Thanks

Kobie
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
If a weekend(day) is included, I would like to remove Saturday and Sunday in the total number of days incremented. So if:

If cboSelectAttempts.ListIndex = 1 Then
txtFlup.Text = Format(Date + 4, "mm/dd/yyyy")
txtBtn.SetFocus
End If

03/29/2012 + 4, I want it to show: 04/04/2012

Bryan
 
Upvote 0
Maybe

Code:
txtFlup.Text = Format(Worksheetfunction.Workday(Date, 4), "mm/dd/yyyy")
 
Upvote 0

Forum statistics

Threads
1,225,613
Messages
6,186,003
Members
453,334
Latest member
Prakash Jha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top