View Single Post
 
Old 04-04-2018, 06:48 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2010 32bit
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

The function seems to work fine when called from a worksheet; the arguments are supplied.
When you call it from another macro you need to supply valid arguments too.
Try the likes of:
Code:
Public Sub ViewPrjByMth()
Dim strField As String, pMonth As Date, amt
pMonth = DateValue("1-Feb-2019")
strField = "Army"
'Worksheets("PrjByMth").Visible = True
'Sheets("PrjByMth").Activate
amt = PrjByMonth(strField, pMonth)
MsgBox amt & ", " & strField & ", " & pMonth
End Sub
The variables don't need to be global.
Reply With Quote