Userform question

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,760
Office Version
2013
Platform
Windows
Re: Userform question if I may ask please

Try this:
Code:
Private Sub ComboBox1_Change()
'Modified  5/22/2019  4:10:21 PM  EDT
Dim SearchString As String
Dim SearchRange As Range
SearchString = ComboBox1.Value
Dim lastrow As Long
Dim i As Long
Dim r As Long
Dim b As Long
Dim Lastcolumn As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Set SearchRange = Range("B2:A" & lastrow).Find(SearchString, LookIn:=xlValues, lookat:=xlWhole)
If SearchRange Is Nothing Then MsgBox SearchString & "  Not Found": Exit Sub
For i = 1 To 7
    Controls("TextBox" & i).Value = Cells(SearchRange.Row, i * 2).Value
Next
Me.TextBox6.Value = Format(Me.TextBox6.Value, "?#,##0.00")
Lastcolumn = Cells(SearchRange.Row, Columns.Count).End(xlToLeft).Column
ListBox1.Clear
For b = 20 To Lastcolumn
If IsNumeric(Cells(SearchRange.Row, b).Value) Then
    ListBox1.AddItem Format(Cells(SearchRange.Row, b).Value, "?#,##0.00")
Else
    ListBox1.AddItem Cells(SearchRange.Row, b).Value
End If
Next
End Sub
 

Some videos you may like

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
3,322
Re: Userform question if I may ask please

Hi,
Sorry for a delay in my reply but had a family fatality.

Works like a charm.

Many thanks
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,760
Office Version
2013
Platform
Windows
Re: Userform question if I may ask please

Glad I was able to help you. Sorry to hear about your loss.
Hi,
Sorry for a delay in my reply but had a family fatality.

Works like a charm.

Many thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,098,910
Messages
5,465,405
Members
406,426
Latest member
slari

This Week's Hot Topics

Top