Can't use workday( in macro

George J

Well-known Member
Joined
Feb 15, 2002
Messages
959
Can anyone tell me what i am doing wrong?

Code:
Dim vardue As Date
Dim varstart As Date

vardue = Cells(i, 7)
varstart = workday(vardue, -3)
I have checked that i have the analysis toolpack activated, and also the vba extensibility library.

What am i missing??

thanks
George
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Note: not all worksheet functions are available in VBA
see this topic in the VBA Help
List of Worksheet Functions Available to Visual Basic

You may want to create a formula for workday in your spreadsheet then pull it from there...

eg...

Code:
Dim vardue As Date
Dim varstart As Date

vardue = Cells(i, 7)
varstart = Cells(i, 8)

hope that helps
 
Upvote 0
First, make sure the "Analysis ToolPak - VBA" Add-In is installed (Tools|Add-Ins). Then click your workbook in the VBE and add a reference to atpvbaen.xls (Tools|References).
 
Upvote 0

Forum statistics

Threads
1,207,095
Messages
6,076,552
Members
446,213
Latest member
bettigb

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