Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 219
Default How to handle user input error

I've written the following to create a new worksheet in the existing
workbook after getting some key data from the user:

Public Sub CreateTribalSheet()

Set wbTribal = ThisWorkbook
Set wsSource = wbTribal.Sheets("Source")

bDataEnt = False
bCancel = False
bFinish = False
bNewData = False

If ThisWorkbook.Name = ActiveWorkbook.Name Then
MsgBox _
"Do not use this workbook to create your reports." _
& Chr(10) & _
"Open a previously used workbook or start" _
& Chr(10) & _
"a new one for the current fiscal year"
End
End If

Application.ScreenUpdating = False

' Get facility name and no. of records from user
lFacilRowsUI = 0
lStartRow = 7


Do
'Show the Facility entry form
frmFacil.Show
Unload frmFacil

If bNewData = True Then
If bDataEnt = False Then
'Add and format new worksheet
Call AddFormatNewWksht
bDataEnt = True
End If
End If
' Application.ScreenUpdating = True
Call EnterFacilData

Loop Until bFinish = True

Call EnterMonthlyTotals
Call TribeNameServDate
Call FileNameandSave
Application.ScreenUpdating = True
ws.Protect Password:=PWORD
End Sub

It calls frmFacil which has the following code for the "Finish" button:

Private Sub btnFinish_Click()
sFacilNameUI = frmFacil.tbFacilName.Text
On Error Resume Next
lFacilRowsUI = frmFacil.tbFacilRows.Value
On Error GoTo 0
If sFacilNameUI < "" And lFacilRowsUI < 0 Then
bNewData = True
bFinish = True
Else
If bDataEnt = False Then
MsgBox "Please enter a both a Facility Name and" & Chr(10) & _
"the number of clients served!", vbOKOnly
'### WHAT TO PUT HERE? ###
Else
bNewData = False
bFinish = True
End If
End If
Unload frmFacil
End Sub

What I don't know is what to do if they fail to fill in the form properly
(the turnover rate is very high, mostly people with NO xl experience at
all). What I want is for the form to reappear and give them another chance
to fill it in. I've tried putting in a goto (or resume) back to the
CreateTribalSheet macro where I show '### WHAT TO PUT HERE ###, even made
that macro public, but I get a compile error, "Label not defined" on the
CreateTribalSheet (even though it knows how to capitalize it when I enter
it!). I'm sure there's a simple error handling procedure of which I'm
unaware. So who is?

Thanks.
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
How do I make the auto fill handle to input data from left to righ Jason Excel Discussion (Misc queries) 2 March 12th 08 10:27 PM
Prompt user for input and utilize that input ninner Excel Worksheet Functions 2 March 28th 07 09:44 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
How to handle error 8007000e Memory Error L. A. M. Excel Programming 6 June 28th 05 04:05 AM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 09:15 AM.

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"