Mahhdy
Mahhdy

Reputation: 592

How to Declare Public instance of Application.Worksheetfunction?

I want to declare application.worksheetfunction as a public variable WF.

I tried:

Public WF As WorksheetFunction

This returns

runtime error 91, "object variable or with block variable not set"

I tried:

Public WF As application.WorksheetFunction

This returns

compile error Type Mismatch

Upvotes: 0

Views: 367

Answers (1)

Sam
Sam

Reputation: 5731

I don't understand why you would do such a thing. There might be a reason I don't understand, so:

Public WF As WorksheetFunction

Sub AnInitMethodOfSomeKind()
    Set WF = WorksheetFunction
End Sub

But, please don't. It is bad.

Upvotes: 3

Related Questions