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: 411
Default How to disallow a zero value in an array

Hi,

Using Excel 2000 and Windows XP professional, I'm using the following
code to create a variable to use in another sub.

In a quoting application I'm designing, I'm collecting all the
quantities for a part number quote into an variable named "a". I have
a userform with a textbox and a command button. See the code I'm
using below.

I have two questions:

How can I save the variable for use in another sub?
How can I make sure the user doesn't click the command button until a
quantity is entered in the text box?

Thanks,

Dan
------------------------------------------------------------------
Private Sub cmdQuantity_Click()
Dim lr As Long, sh As Worksheet
Dim aQuant As Variant
Dim cont
Static a() As String
Dim lngArrayCounter As Integer

lngArrayCounter = -1
On Error Resume Next
lngArrayCounter = UBound(a)
On Error GoTo 0
If lngArrayCounter = -1 Then
ReDim Preserve a(0)
Else
ReDim Preserve a(lngArrayCounter + 1)
End If
a(UBound(a)) = txtQuantity_1.Text


cont = MsgBox("DO YOU NEED TO MAKE ANOTHER ENTRY?", vbYesNo,
"CONTINUE?")
If cont = vbYes Then
Me.txtQuantity_1.Text = ""
Me.txtQuantity_1.SetFocus
End If
End Sub
 
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
Disallow duplicates in different worksheets ClaireView Excel Discussion (Misc queries) 5 February 4th 08 08:05 PM
Disallow CTRL+ALT+DEL jutlaux Excel Programming 8 November 17th 06 06:10 PM
Disallow cell entries hopeace Excel Discussion (Misc queries) 3 October 14th 05 12:19 AM
Disallow Paste Steph[_3_] Excel Programming 3 June 22nd 05 05:37 PM
Disallow sorting of data. Tom Ogilvy Excel Programming 1 January 4th 05 04:11 PM


All times are GMT +1. The time now is 06:43 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"