S
Shazi
Hi,
I found the below procedure in a userform, its showing the Listrow1
contents in the lable on the Userform.
Private Sub ListBox1_Change()
Dim SourceData As Range
Dim Val1 As String, Val2 As String, Val3 As String
Set SourceRange = Range(ListBox1.RowSource)
Val1 = ListBox1.Value
Val2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1,
1).Value
Val3 = SourceRange.Offset(ListBox1.ListIndex, 2).Resize(1,
1).Value
Label1.Caption = Val1 & " " & Val2 & " " & Val3
End Sub
But I want to make some thing like this:
Listbox1 = RowSource PROPERTY (B5:H500)
my colums names are
B: Name
C: Company
D: MobileNo.
E: Phone 1
F: Phone 2
G: Fax
H: E-Mail
I put 6 labels in the userform to get the related data in Label from
the Listbox, when I scroll the listbox items.
I mean when I scroll the listbox by using up and down key Name should
appear in the Label, and Company name should appear in the other
lable.........
If it is possible pls send me reply, I will be appreciated to you.
Thanks and regards.
shahzad
I found the below procedure in a userform, its showing the Listrow1
contents in the lable on the Userform.
Private Sub ListBox1_Change()
Dim SourceData As Range
Dim Val1 As String, Val2 As String, Val3 As String
Set SourceRange = Range(ListBox1.RowSource)
Val1 = ListBox1.Value
Val2 = SourceRange.Offset(ListBox1.ListIndex, 1).Resize(1,
1).Value
Val3 = SourceRange.Offset(ListBox1.ListIndex, 2).Resize(1,
1).Value
Label1.Caption = Val1 & " " & Val2 & " " & Val3
End Sub
But I want to make some thing like this:
Listbox1 = RowSource PROPERTY (B5:H500)
my colums names are
B: Name
C: Company
D: MobileNo.
E: Phone 1
F: Phone 2
G: Fax
H: E-Mail
I put 6 labels in the userform to get the related data in Label from
the Listbox, when I scroll the listbox items.
I mean when I scroll the listbox by using up and down key Name should
appear in the Label, and Company name should appear in the other
lable.........
If it is possible pls send me reply, I will be appreciated to you.
Thanks and regards.
shahzad