Open Function Dialog in VBA

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,907
Office Version
  1. 365
Platform
  1. Windows
Hi

Does anybody know how to open the function dialog on a specific worksheet function? :confused:

I have a few UDFs and I would like to create a button that will open the dialog on a specific UDF so that the required arguments can be better seen. Almost as though to function as a wizard.

I am familar with this code:
Code:
Application.Dialogs(xlDialogFunctionWizard).Show
But I want some adaptation to navigate to UDF, e.g. EVA.

Regards
Jon
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
This worked for me:

Code:
Sub Test()
    ActiveCell.Formula = "=AddUp(A1,A2)"
    Application.CommandBars("Standard").Controls("Paste Function").Execute
End Sub

Function AddUp(Val1 As Variant, Val2 As Variant) As Variant
    AddUp = Val1 + Val2
End Function
 
Upvote 0
Hi Andrew

Thanks for this. Still having a problem though, grateful for some further help.

Using your example this produces a run-time error on:
Code:
Application.CommandBars("Standard").Controls("Paste Function").Execute
Invalid procedure call or argument.

Also, I notice this code populates the arguments. I am wondering if it is possible to leave blank so that it can be populated by the user when the function dialog pops up.

Many thanks
Jon
 
Upvote 0
Open Function Dialog in VBA (Solved)

Hi Andrew

You are a star. I have this working with one small adaptation:
Code:
Sub Test()
    ActiveCell.Formula = "=AddUp()"
    Application.Dialogs(xlDialogFunctionWizard).Show
End Sub

Function AddUp(Val1 As Variant, Val2 As Variant) As Variant
    AddUp = Val1 + Val2
End Function

Many thanks for your help.
Jon :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,416
Messages
6,119,384
Members
448,889
Latest member
TS_711

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