question

AtherMian-4921 avatar image
0 Votes"
AtherMian-4921 asked JackJJun-MSFT edited

Macro to launch data form when table doesn't start at A1

Hi,

My data is formatted as an Excel table and the table starts at A5. All I am trying to do is show the built-in Excel form

When I run the following macro I get this error.

Run-time error 1004 ShowDataForm Method of Worksheet class failed

Sub DataForm()
ActiveSheet.ShowDataForm
End Sub

Your help is greatly appreciated.

Thanks,

Ather

office-vba-dev
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Viorel-1 avatar image
0 Votes"
Viorel-1 answered

According to search results (https://www.bing.com/search?q=ShowDataForm+error+1004), try this:

 Sub DataForm()
    ActiveSheet.Range("A5").CurrentRegion.Name = "database"
    ActiveSheet.ShowDataForm
 End Sub


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.