Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userforms submit button to clear after it enters data?


I have User form that has a submit button that when selected enters dat
to the spreadsheet, but doesn't clear the form unless you click on th
clear form button. Is there anyway to write that it will also clea
the form after it has entered all of the data into the worksheet?

Here is the VB for the button...

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

Thanks
Carl

--
carlarug
-----------------------------------------------------------------------
carlaruge's Profile: http://www.excelforum.com/member.php...nfo&userid=658
View this thread: http://www.excelforum.com/showthread.php?threadid=38521

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userforms submit button to clear after it enters data?

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
txtAddress.Value
txtCity.Value = ""
txtState.Value = ""
txtZip.Value = ""
txtdegree1.Value = ""
txtdegree2.Value = ""
txtCert1.Value = ""
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
End Sub

--
Regards,
Tom Ogilvy

"carlaruge" wrote
in message ...

I have User form that has a submit button that when selected enters data
to the spreadsheet, but doesn't clear the form unless you click on the
clear form button. Is there anyway to write that it will also clear
the form after it has entered all of the data into the worksheet?

Here is the VB for the button...

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

Thanks
Carla


--
carlaruge
------------------------------------------------------------------------
carlaruge's Profile:

http://www.excelforum.com/member.php...fo&userid=6583
View this thread: http://www.excelforum.com/showthread...hreadid=385217



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userforms submit button to clear after it enters data?


I used this to initilize the form also, I thought I tried this but must
have had it in the wrong place.

Thanks for your help!


--
carlaruge
------------------------------------------------------------------------
carlaruge's Profile: http://www.excelforum.com/member.php...fo&userid=6583
View this thread: http://www.excelforum.com/showthread...hreadid=385217

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Submit Button Edith Excel Discussion (Misc queries) 0 April 8th 08 09:56 PM
How to clear a group of combo boxes after a submit to another worksheet Jonah Excel Discussion (Misc queries) 1 March 7th 08 12:39 AM
Clear a set of combo boxes after a Submit of data to a new sheet. Jonah Excel Worksheet Functions 0 March 3rd 08 12:05 AM
Submit Button? Bip Excel Discussion (Misc queries) 1 January 15th 07 12:32 PM
Submit Button edwardpestian Excel Worksheet Functions 1 April 27th 06 08:24 PM


All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"