Share via

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

Ather Mian 1 Reputation point
2021-10-15T13:50:59.873+00:00

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

Developer technologies | Visual Basic for Applications
0 comments No comments

1 answer

Sort by: Most helpful
  1. Viorel 127K Reputation points
    2021-10-15T16:26:29.497+00:00

    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
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.