• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

about ListBox

sgmpatnaik

Active Member
Hello

i have one user form in that UserForm i have placed one List Box and One TextBox.

now what i want i want popup the Text in Text Box of List Box2nd option, i mean in my list Box i mention as

a = Split("meter, inch, foot, yard", ",")
b = Split("m, In, Ft, Yd", ",")

when i select the meter in ListBox then in Text Box to be display as m, inch to be In so far

here i try the below code but i fail
Code:
Option Explicit
Dim a() As String
Dim b() As String
Dim i As Long
Sub UserForm_Initialize()
a = Split("meter, inch, foot, yard", ",")
b = Split("m, In, Ft, Yd", ",")
ListBox1.List = a

End Sub
Private Sub ListBox1_Change()
  With Me
  On Error Resume Next
  .TextBox1.Value = .ListBox1.Value
  
  End With
End Sub

Kindly suggest me on this

Thanks

Regards
 
I think the line
Code:
.TextBox1.Value = .ListBox1.Value
should be
Code:
 .TextBox1.Value = b(.ListBox1.ListIndex)
 
Back
Top