Hi Anyone who could correct me for my error
Basically Not getting right Value in Textbox1.Text and Label1.Caption when clicking on Combobox1
In module
<code>
in UserForm
<code>
</code>
Thanks
Basically Not getting right Value in Textbox1.Text and Label1.Caption when clicking on Combobox1
In module
<code>
Code:
Option Explicit
Public arrayProdWs(1 To 2, 1 To 2, 1 To 2) As String
Public arrayAccWs(1 To 2, 1 To 2, 1 To 2) As String
Public arrayCoName(1 To 2, 1 To 2, 1 To 2) As String
Public prodWs As Integer, accWs As Integer, CoName As Integer
</code>
in UserForm
<code>
Code:
Private Sub UserForm_Initialize()
arrayProdWs(1, 1, 1) = "Product Sheet1"
arrayAccWs(1, 1, 1) = "Acc Sheet1"
arrayCoName(1, 1, 1) = "Co Name 1"
arrayProdWs(2, 1, 1) = "Product Sheet2"
arrayAccWs(2, 1, 1) = "Acc Sheet2"
arrayCoName(2, 1, 1) = "Co Name 2"
For prodWs% = 1 To UBound(arrayProdWs, 1)
UserForm1.ComboBox1.AddItem arrayProdWs(prodWs%, 1, 1)
Next prodWs%
End Sub
Private Sub ComboBox1_Click()
[COLOR=#ff0000][B]'Clicking on Combobox not able to get value in Textbox of AccSheet 1 and AccSheet2
'in Label not able to get Co Name 1 and Co Name 2
[/B][/COLOR]
For prodWs% = 1 To UBound(arrayProdWs, 1)
For accWs% = 1 To UBound(arrayAccWs, 1)
UserForm1.TextBox1.Text = arrayAccWs(ComboBox1.ListIndex + 1, prodWs%, accWs%)
UserForm1.Label1.Caption = arrayAccWs(1, 1, accWs%)
Next accWs%
Next prodWs%
End sub
</code>
Thanks
Last edited: