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: 586
Default Clearing Variable Values in Array using For...Next

I would like to make all variable values in the two Arrays below = 0. Note:
All my variables listed in the Arrays are declared in the Declarations
section at the top of the UserForm Module. When I run this code it doesn't
work the way I want it too. This is an example in the immediate window
(which is not what I want):

currently:
?myBOM_Qty(0) = 0
?AlumFace_Qty = 32

it should read:
?myBOM_Qty(0) = 0
?AlumFace_Qty = 0

Why?

Private Sub cmbJobCosting_Click()

Dim myBOM_Des As Variant
Dim myBOM_Qty As Variant

' Establish Array to CLEAR
myBOM_Des = Array(AlumFace_Row, Texture_Row, Primer_Row,
Paint1_Row, Paint2_Row, Paint3_Row, Paint4_Row, Vinyl1_Row, _
Vinyl2_Row, Vinyl3_Row, Vinyl4_Row,
ClearVinyl_Row, Ink_Row, Plastic_Row)

' Establish Array to CLEAR
myBOM_Qty = Array(AlumFace_Qty, Texture_Qty, Primer_Qty,
Paint1_Qty, Paint2_Qty, Paint3_Qty, Paint4_Qty, Vinyl1_Qty, _
Vinyl2_Qty, Vinyl3_Qty, Vinyl4_Qty,
ClearVinyl_Qty, Ink_Qty, Plastic_Qty)

' resets all variables to Empty in Arrays
If UBound(myBOM_Des) < UBound(myBOM_Qty) Then
MsgBox "The variable count in myBOM_Des and myBOM_Qty does
NOT equal. Call VBA Developer.", vbCritical
Exit Sub
Else
For i = LBound(myBOM_Des) To UBound(myBOM_Des)
myBOM_Des(i) = 0
myBOM_Qty(i) = 0
Next i
End If

End Sub
--
Cheers,
Ryan
 
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
Series values from an array variable Mitch Excel Programming 5 March 12th 08 11:55 PM
Clearing all values in a User Defined Type variable J Streger Excel Programming 2 April 27th 06 08:01 PM
Getting values from a variable sized range into an array Ken Loomis Excel Programming 8 October 5th 04 09:04 AM
vba clearing out values stored in array chick-racer[_44_] Excel Programming 2 December 1st 03 09:05 PM


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