Posts

Showing posts from July, 2020

Search Multiple Values in Worksheet Data

Source  https://www.exceltrainingvideos.com/search-multiple-values-in-worksheet-data/ Search Multiple Values in Worksheet Data How to search multiple values in worksheet data using VBA. Earlier we had learnt how to  search for data in a worksheet  using a looping process but were able to find a single value. Today we learn to extract all the occurrences of data in our worksheet like an item code with VBA. Watch the video below: Here’s the complete VBA code to find multiple data withe the same value: Sub searchMultipleValues() Dim erow As Long Dim ws As Worksheet Dim lastrow As Long Dim count As Integer lastrow = Sheets(“item_price”).Cells(Rows.count, 1).End(xlUp).Row Sheet2.Range(“a11:C1000”).ClearContents count = 0 Dim p As Long p = 11 For x = 2 To lastrow If Sheets(“item_price”).Cells(x, 1) = Sheet2.Range(“b3”) Then Sheet2.Cells(p, 1) = Sheets(“item_price”).Cells(x, 1) Sheet2.Cells(p, 2) = Sheets(“item_price”).Cells(x, 2) Sheet2.Cells(p, 3) = She...