I have compiled wheel data but want a VBA macro that copies any cell from sheet 1 (named: SheetSJ) that matches partial text, and then copies that cell's data into sheet 2. This is to make the data much easier to work with.
- Search each row for any cells in SheetJS that contain text "Product ID", if no matches then ignore
- If any cell (text) matches, copy that cell, and paste the contents to sheet 2 column B (beginning with row 2)
- Search each row for any cells in SheetJS that contain text "Bolt Pattern", if no matches then ignore
- If any cell (text) matches, copy that cell, and paste the contents to sheet 2 column D (beginning with row 2)
As evident in the picture, the data is all over the place in each column and thus the macro cannot use any particular cell for reference. It can only match text values (which are unique).
Sub Test()
For Each Cell In Sheets(1).Range("A1:ZZ200")
If Cell.Value = "Product ID" Then
matchRow = Cell.Row
Rows(matchRow & ":" & matchRow).Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End If
Next
End Sub
I managed to find some examples online but they copy the entire row not the individual cell.