'Dim' = dimension = define variable and type (see online Help)
'Option Explicit' = Require all variables to be explicitly Dim-ed (see online Help)
I think your original code
made sq a variant with an array in it (not sure)
Use the [Go Advanced] and the paperclip icon to attach a file to your post, not Dropbox or some other file storage site
but That is Not what I want
What do you want?
I didn't try to run anything
Option Explicit ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Private Sub ComboBox1_Change()
Dim j As Long ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
If ComboBox1.ListIndex = -1 Or ComboBox2.ListIndex = -1 Then Exit Sub
For j = 1 To 3
Me("TextBox" & j) = ComboBox2.Column(j + 3 * ComboBox1.ListIndex)
Next
End Sub
Private Sub ComboBox2_Change()
M_calc
End Sub
Private Sub TextBox1_Change()
M_Box 1
End Sub
Private Sub TextBox2_Change()
M_Box 2
End Sub
Private Sub TextBox3_Change()
M_Box 3
End Sub
Sub M_Box(Y)
ComboBox2.Column(Y + 3 * ComboBox1.ListIndex) = Me("TextBox" & Y)
M_calc
End Sub
Sub M_calc()
Dim sp(0 To 6) As Double ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Dim sq(0 To 6) As Double ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' ReDim sp(6) ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' sq = sp ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
With ComboBox2
For j = 1 To 19 Step 3
c00 = c00 + Val(.Column(j + 0))
sp(j \ 3) = Val(.Column(j + 1))
sq(j \ 3) = Val(.Column(j + 2))
Next
.Column(22) = c00
.Column(23) = Application.Max(sp)
.Column(24) = Application.Min(sq)
Frame1.Caption = Space(2) & .Column(22) & Space(14) & .Column(23) & Space(10) & .Column(24)
End With
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Ark1.Cells(1).CurrentRegion.Offset(2).Value = ComboBox2.List
End Sub