Form Micro

J

Jim Cox

I am trying to active a form from a macro. I used the 'copy' function but it
fails. It tells me that the ShowDataFrom method failed. The spreadsheet will
be used my schools in our district to register students for the science
fair. I'm not the proficient in Excel.

Sub InputList()
'
' InputList Macro
' Macro recorded 10/5/2006 by 'Jim C'

'
Sheets("Names").Select
Range("A4:E4").Select
ActiveSheet.ShowDataForm
End Sub

Thanks Jim C
 
J

JLGWhiz

"UserForm1.Show" without the quotemarks will work if you only have one
UserForm for that workbook. To make it go away use "Unload UserForm1" ,
again without the quotemarks. You don't need the ActiveSheet preface since
the UserForm is a stand alone object.

If the UserForm has a name, you can use it instead of UserForm1, i.e.
"FormName.Show"
 
J

Jim Cox

Thanks for the info, but I'm still having a problem. At least I'm headed in
the right direction

Thanks
Jim C
 
D

Dave Peterson

Do you know how many columns are part of the data table?

Can you pick out a column that always has data if that row is used?

Option Explicit
Sub testme01()
Dim LastRow as long
Application.DisplayAlerts = False
With activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.Range("A4:E" & lastRow).Name = "'" & .Name & "'!database"
.ShowDataForm
End With
Application.DisplayAlerts = True
End Sub

I started in A4 (like your code showed) and then used column A to find the last
row used. And went to column E (like your code showed).

By naming the range DataBase, excel's showdataform knew where to look to find
the data.
 

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

Similar Threads

Activate Form using a macro 2
insert a line 1
Design a Form for Excel 0
Excel Data Form 2
Totally confused about forms + macro 1
Multiple make table queries in one? 3
Coding Help 5
interactive findnext 2

Top