search dynamics

Osmarls

New Member
Joined
Jul 18, 2010
Messages
5
Hi...
When the form is opened it load the names of a spreadsheet in ComboBox1, then I want to select which name search and command, are usually made all the names, how can I do to stop automatically once clicked the button it alone do the research, for all names that are in ComboBox1.

Private Sub UserForm_Initialize()
Dim QuantasLinhas, Cont
QuantasLinhas = Workbooks("Pesquisa1 .xls").Sheets("Dados").Range("A65000").End(xlUp).Row
For Cont = 2 To QuantasLinhas
Me.ComboBox1.AddItem Plan4.Range("A" & Cont)
End Sub

Private Sub PESQUISA_Click()
Dim i As Integer
Dim pes As Variant
Dim WS As Worksheet
Dim rg As Range
For Each WS In ActiveWorkbook.Worksheets
For Each rg In WS.[D1:D80]
If rg = ComboBox1.Value And rg.Offset(, -2) <> "" Then i = i + 1
Next rg
Next WS
txtvalor.Value = i
txtnome.Value = ComboBox1.Value
Me.ListBox1.AddItem Me.txtnome.Value
Me.ListBox1.List(Me.ListBox1.ListCount - 1, 1) = Me.txtvalor.value
End Sub

Att

Osmarls :)
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,613
Messages
6,179,898
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top