build in functions in vba

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I am reading the article below which list most popular functions in vba.

https://www.excelfunctions.net/vba-functions.html

I am not sure based on what the author listed all these functions?? Where are these functions located? Part of which class? I tried to user Object browser but could not find these functions anywhere?

There are other list of functions, for example, Average(), Vlookup(), Hlookup() etc which are part of WorkSheetFunction object, the author did not list them, why is that? these function can not be called without using

WorkSheetFunction.FunctionName()

while I can not use average() function without WOrksheetFunction.average(), I can use Now(), Date() function without anything!!

Code:
'time
Function mytime() As Date
   mytime = Time
End Function

'date
Function mydate() As Date
   mydate = Date
End Function

' average
Function myaverage(x As Double, y As Double) As Double
   myaverage = WorksheetFunction.Average(x, y)
End Function
Thank you very much.
 
Last edited:

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
The article you are reading is for VBA functions not worksheet functions which these are (Average(), Vlookup(), Hlookup() ).

If you type "list of functions" in the Help box (top RH side), they will be there
 
Upvote 0
I think I got it now. So WorkSheetFunction means the regular functions that is used in Worksheet (no VBA) but it can be also used in VBA if it is called via WorkSheetFunction object. While the VBA functions (the link above), are the functions that used in VBA only. Am I right?

If I am right, then one more question please. Are these VBA functions accessible anywhere. I am I do not need to user any class or object to call them? for example

ClassName.FunctionName
ObjectName.FunctionName

Sorry which help box? in the link above?
 
Last edited:
Upvote 0
While the VBA functions (the link above), are the functions that used in VBA only. Am I right?

Correct !

Are these VBA functions accessible anywhere


If I understand you correctly, yes.

Click on one of the functions in the article and look at the examples, you will see thay do not have to be preceeded by other code for them to function.
 
Upvote 0
Thank you very much. That was so confusing but not it is clear. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top