ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB FORMs, buttons, window properties (https://www.excelbanter.com/excel-programming/292747-vbulletin-forms-buttons-window-properties.html)

carlaruge

VB FORMs, buttons, window properties
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

VB FORMs, buttons, window properties
 
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)

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

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

The second thing is there a way to have the submit button in the VB
Form submit the information and then clear the form after it is
entered. I have a clear form button to do this now but would like the
person who clicks can go ahead and start on a new entry. Here is the
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!


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com