Search all working documents

mody300

New Member
Joined
Jul 27, 2023
Messages
4
Office Version
  1. 2010
Platform
  1. Web
VBA Code:
On Error Resume Next
If TextBox8.Value = "" Then ListBox1.Clear: Exit Sub

Dim X As Worksheet
Dim c As Range
Dim k As Integer
Dim m As Date
Dim n As Date

ListBox1.Clear
k = 0

m = CDate(TextBox9.Value)
n = CDate(TextBox10.Value)

For Each X In ThisWorkbook.Worksheets
    ss = X.Cells(Rows.Count, 2).End(xlUp).Row
    For Each c In X.Range("B2:B" & ss)
        If (c.Value Like "*" & ComboBox1.Value & "*" Or c.Value Like "*" & ComboBox2.Value & "*") And (c.Offset(0, 2).Value >= m And c.Offset(0, 2).Value <= n) Then
            ListBox1.AddItem
            ListBox1.List(k, 0) = X.Cells(c.Row, 1).Value
            ListBox1.List(k, 1) = CDate(X.Cells(c.Row, 2).Value)
            ListBox1.List(k, 2) = X.Cells(c.Row, 3).Value
            ListBox1.List(k, 3) = X.Cells(c.Row, 4).Value
            ListBox1.List(k, 4) = X.Cells(c.Row, 5).Value
            ListBox1.List(k, 5) = X.Cells(c.Row, 6).Value
            ListBox1.List(k, 6) = X.Cells(c.Row, 7).Value
            ListBox1.List(k, 7) = X.Cells(c.Row, 8).Value
            ListBox1.List(k, 8) = X.Cells(c.Row, 9).Value
            ListBox1.List(k, 9) = X.Cells(c.Row, 10).Value
            k = k + 1
        End If
    Next c
Next X
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Good evening

I'm working on a user model. It is a research process that depends on several criteria. There are two textboxes (date) and two listboxes (customer - product code), but this depends on finding multiple worksheets and retrieving them from the listbox. Is there a search code like this?

Please display all checks in the yellow columns of the listbox based on the combobox and textbox options (Date)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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