diegomuser
New Member
- Joined
- May 16, 2021
- Messages
- 3
- Office Version
- 2019
- Platform
- 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
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!
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!