user3692356
user3692356

Reputation: 3

Excel VBA: How to return value without making a function that is available in the formula bar

From what I understand out of subs, functions, and labels the only thing that returns values is functions right?

However when you make a function is will make it available in the spreadsheet when you type = in the formula bar. Is there anyway around this? I don't necessarily want an accessible function, I just want somewhere to stick repetitively used code & return a value.

Upvotes: 0

Views: 64

Answers (1)

coopejoh
coopejoh

Reputation: 61

Add The keyword Private in your function declaration

Private Function DoSomething()
...
End Function

The default is Public

You can read more on VBA Functions & Subroutines

Upvotes: 1

Related Questions