Cannot call the worksheet function Weeknum

  • Thread starter Michiel via OfficeKB.com
  • Start date
M

Michiel via OfficeKB.com

Anyone who can shine a light on this?

1) Worksheet functions can be called in VBA by using: Application.
WorksheetFunctionName
2) The worksheet function 'WeekNum' Exists
3) It works fine in my worksheet '=WEEKNUM(NOW(),1)'

Based on these I would say this would also work:

Sub WeekDay()
Dim dt As Date

dt = Now()
MsgBox Application.Weeknum(dt, 1)
End Sub

However I get: "Object doesn't support this property or method" (err#438)

I also know the Weeknum can be directly called from VBA by installing the Add-
In. But I just want to use the worksheet function.

Anyone?
 
M

Mike H

Hi,

I should have added that if you want to use weeknum then try this

MyWeek = Application.Run("ATPVBAEN.XLA!weeknum", dt, 1)

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top