VB FORMs, buttons, window properties


C

carlaruge

I have created a form in VB environment of Excel. The form is fo
people to type information in and then hit submit. The informatio
then goes into the spreadsheet. This all works great!

Two things, I have a button in my spreadsheet that opens the form i
excel. Can you have the actual program or sheet minimize when the for
is loaded? if so How?

The second thing is there a way to have the submit button in the V
Form submit the information and then clear the form after it i
entered. I have a clear form button to do this now but would like th
person who clicks can go ahead and start on a new entry. Here is th
code for the button that I am using.

Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Sign In").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtName.Value
ActiveCell.Offset(0, 1) = txtAddress.Value
ActiveCell.Offset(0, 2) = txtCity.Value
ActiveCell.Offset(0, 3) = txtState.Value
ActiveCell.Offset(0, 4) = txtZip.Value
ActiveCell.Offset(0, 6) = txtdegree1.Value
ActiveCell.Offset(0, 7) = txtdegree2.Value
ActiveCell.Offset(0, 8) = txtCert1.Value
ActiveCell.Offset(0, 9) = txtCert1.Value
If optElementary = True Then
ActiveCell.Offset(0, 5).Value = "Elementary"
ElseIf optMiddle = True Then
ActiveCell.Offset(0, 5).Value = "Middle School"
Else
ActiveCell.Offset(0, 5).Value = "Secondary"
End If

ANy help would be great
 
Ad

Advertisements

B

Bob Phillips

Carla,

First part

ActiveWindow.WindowState = xlMinimized
UserForm1.Show

Second part

Just clear each control individually, like

Me.Textbox1.Text = ""

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Top