List all elements in a specific VBA object

BartH

New Member
Joined
Jul 4, 2006
Messages
14
Hi,

We are able to list for instance all sheets in a workbook:

VBA Code:
Sub getSheetsOfWorkbook()
    Dim sh As Worksheet
    Dim i As Integer
    ActiveWorkbook.Sheets.Add
    For Each sh In ActiveWorkbook.Sheets
        i = i + 1
        ActiveSheet.Cells(i, 1) = sh.name
    Next
End Sub

How can I list all worksheetfunctions?

Rich (BB code):
Sub getEachFunction()
    Dim f As WorksheetFunction
    Dim i As Integer
    ActiveWorkbook.Sheets.Add
    For Each f In Application.?
        i = i + 1
        ActiveSheet.Cells(i, 1) = f.name
    Next
End Sub

Grtz BartH
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
The comparison of Worksheets to WorksheetFunction doesn't work. Worksheets is a Collection. WorksheetFunction is not a Collection. It is a set of methods. There is no way to iterate through the names of all worksheet functions.
 
Upvote 0
The comparison of Worksheets to WorksheetFunction doesn't work. Worksheets is a Collection. WorksheetFunction is not a Collection. It is a set of methods. There is no way to iterate through the names of all worksheet functions.
That is disappointing. Can't I somehow load them in a custom object?
 
Upvote 0
What is your ultimate need? What are you trying to do?

Here is a list of the supported functions. You could create your own Collection, dictionary, array, or other data structure with this list. The best way to proceed all depends on your goal.
Hi 6StringJazzer,
I know of that list, but it is not up to date with the latest added functions (f.i. xlookup).
There are more situations where I would like to be able to list all members of a class,
but in this case, I am working on a method to evaluate and report all steps in formulas that hold values.
So for instance
Rich (BB code):
IF(
searchVal = "myComp",
'List'!$A$1:$B$233,
2,
0)
= 235.66

The red values I have added.

It would have been nice if I could list all available functions (and future new ones), perhaps even with their corresponding arguments.
As there are many formulas, I'd need to make some sort of array to determine which arguments I need to supply a value for.

Grtz BartH
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,632
Messages
6,120,655
Members
448,975
Latest member
sweeberry

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