Macro (Top open a data form)

  • Thread starter Thread starter adn4n
  • Start date Start date
A

adn4n

Hi, i am currently trying to create a macro regarding editing staf
details on a worksheet.......

therefore i recorded a macro and named it editstafflist, i highlighte
my headings...and then went to 'data > form' and then had to close th
form and then stop my macro. It wouldnt allow me to stop my macr
whilst the dialogue box was open. Anyways after stopping the macro
drew out a button and assigned this 'editstafflist' macro to it.
saved my sheet and then clicked on the button, but a error '1004' kep
occuring, can anyone please help me on this as i am rather stuck
thankyou.

basically all i need is a macro, so that everytime it is clicked a dat
form would show, so that it allows a user to edit, delete, or allow th
user to enter a new employee.. regards
 
Do you use xl97?

And is your button from the control toolbox toolbar?

If yes, try changing its .takefocusonclick property to false.

(Or alternatively, add
activecell.activate
to the top of your code)

It's a bug in xl97 that was fixed in xl2k.

That might be enough to get you going again.

But here's a version that'll show that data|Form dialog:

Option Explicit
Sub testme()

Dim wks As Worksheet
Set wks = Worksheets("sheet1")

With wks
Application.DisplayAlerts = False
.ShowDataForm
Application.DisplayAlerts = True
End With

End Sub

If you find this less than optimal, you could use John Walkenbach's enhanced
data form:
http://j-walk.com/ss/dataform/index.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top