Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can give this a try... I changed the variable to a static array of
strings, since you probably want the array to persist and a text box by default contains strings... Private Sub Add_Click() 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)) = textbox1.Text End Sub -- HTH... Jim Thomlinson "Rbp9ad" wrote: I have a user form with a textbox and two command buttons. The command buttons are named Add and Done. When the user hits add I want the text in the textbox to be added to a variable array. When the user hits the done button I want to find each value in the array in the first column of the active worksheet and replace it with the minimum value from the array. How do I create this array? How do I pass the array to the done button click event? Private Sub Add_Click() Dim a() As Variant ReDim Preserve a(UBound(a) + 1) a(UBound(a)) = textbox1.Text End Sub This gives me a subscript out of range message. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Array problem - TIA | Excel Worksheet Functions | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
array use problem | Excel Programming | |||
Array Problem | Excel Programming |