Complement search engine in vba with data segmentation

diegomuser

New Member
Joined
May 16, 2021
Messages
3
Office Version
  1. 2019
Platform
  1. MacOS
I am creating an inventory spreadsheet that has 2 options to filter information from a product table.

1) Search by means of a macro that filters any word in a table.
2) The classic segmentation of data by category.


1) Code VBA Search

VBA Code:
Sub search()
Application.Calculation = xlCalculationManual
Dim bus$, que$, r As Range, fr&, cr%, filas&

    bus = InputBox("... search: ", "Search ...", "?")
    Set r = Range("products")
        r.RowHeight = 32
Application.ScreenUpdating = False
        For fr = 1 To r.Rows.Count
            que = Empty
            For cr = 1 To r.Columns.Count
                que = que & r(fr, cr)
            Next
            
            If InStr(1, que, bus, vbTextCompare) = 0 Then
                r(fr, 1).RowHeight = 0
            Else
                filas = filas + 1
            End If
        Next
        
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

The problem I have is that I cannot complement or relate them, for example when I use the search engine for a certain word, I would like the data segmentation to select the category.

Any suggestion?
Thanks!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

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