Quote Originally Posted by VBA Beginner
Hello all,

I am very new to VBA, and my boss gave me a very simple assignment to do. Basically, right now the code is pulling data for forecasts for the following 10 days, and the code is the following:

WHERE (((dbo_ACTUAL_HDD_DAILY.DATE)>=Now()-1 And (dbo_ACTUAL_HDD_DAILY.DATE)<Now()+9)

All he wants modified is to pull data for the entire current Month (Ex. if it is in the middle of July, he would want the data from July 1-July 31, or if February from Feb 1-Feb 28) It would be nice to do this without having to change the VBA every month.

Thanks for the help, I know its really simple but I hope I will get the hang of this eventually.
Hi,

in Tools, Add-ins is an Analysis Toolpack, which contains an EOMonth formula, but I don't think this is directly available to VB.

One method is
Dim mydate
Range("A1").Formula = "=eomonth(today(), 0)"
mydate = Range("A1").Value
MsgBox mydate
and use mydate in place of your <Now()+9

hth
---