Excel: How to open the Data Entry form from VBA?

code_fodder picture code_fodder · Oct 16, 2014 · Viewed 8.9k times · Source

There is a built-in data entry form in Excel. I have added a shortcut to this and its quite good. It has a few little issues (i.e. it depends what cell you have selected as to what data it fills in the form).

So I want to wrap it up into a macro and add my own button. My little macro will select the appropriate cell. So the question is, using VBA, how do you call the build-in Data Entry form?

-EDIT-

Seems my question is not clear... so here is some more:

There is a built-in data entry form that you can use, see here: Built-in Data Entry Form

I want to open this form using excel VBA, like this:

Sub OpenTheBuiltinDataEntryForm()
    ' Add code here to open the built-in data entry form...    
End Sub

Answer

Rory picture Rory · Oct 16, 2014

The line you are looking for is:

Activesheet.ShowDataForm

but note that your data table must begin within A1:B2 or be named Database or you will get an error.