LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User Form

First I am NEW to VBA/VBE, so try not to laugh too much at my codes.

What I'm trying to do (key word trying) is create a phone list tha
uses a user form for input then displays it on my worksheet. I'm almos
there (I thought). When I tested the user form it gives me an error i
I leave one of the two phone number text boxes blank.
I need help with creating some sort of message box that will resume i
the user clicks OK, or something of the sort.

Here is the code

(Any suggestions will be greatly appreciated)

Private Sub OKButton_Click()
Dim NextRow As Long

' Making sure Sheet1 is active
Sheets("Phone_List").Activate

' Make sure a name is entered
If TextBoxName.Text = "" Then
MsgBox "You must enter a name."
TextBoxName.SetFocus
Exit Sub
End If

' Determine the next empty row
NextRow = _
Application.WorksheetFunction.CountA(Range("A:A")) + 1
' Transfer the name
Cells(NextRow, 1) = TextBoxName.Text

' Transfer the shift
If OptionButton117 Then Cells(NextRow, 4) = "11-7"
If OptionButton73 Then Cells(NextRow, 4) = "7-3"
If OptionButton311 Then Cells(NextRow, 4) = "3-11"

' The issues is below

' Transfer the phone numbers
If TextBoxHN1 Then Cells(NextRow, 2) = TextBoxHN1 & TextBoxHN2
TextBoxHN3
If TextBoxCN1 Then Cells(NextRow, 3) = TextBoxCN1 & TextBoxCN2
TextBoxCN3


' Clear the name control for the next entry
TextBoxName.Text = ""
TextBoxName.SetFocus

' Clear the home number
TextBoxHN1.Text = ""
TextBoxHN1.SetFocus
TextBoxHN2.Text = ""
TextBoxHN2.SetFocus
TextBoxHN3.Text = ""
TextBoxHN3.SetFocus


' Clear the cell number
TextBoxCN1.Text = ""
TextBoxCN1.SetFocus
TextBoxCN2.Text = ""
TextBoxCN2.SetFocus
TextBoxCN3.Text = ""
TextBoxCN3.SetFocus
TextBoxName.SetFocus


' Ya I thought I was finished

End Sub

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

 
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
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User Form Obi-Wan Kenobi Excel Discussion (Misc queries) 1 March 23rd 06 07:21 PM
user form Bill[_19_] Excel Programming 0 October 23rd 03 04:32 AM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM
User Form SP Excel Programming 2 July 21st 03 11:34 PM


All times are GMT +1. The time now is 01:45 AM.

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

About Us

"It's about Microsoft Excel"