Hey everyone!
I am having some trouble writing a macro that will search sheet full of data, find cells that match a given criteria, copy other cells in the same row as the cell that matches the criteria, and then paste those cells in the same row on a different sheet. I need all the matching rows of cells to stack downward.
The tough part about this is that I need this same thing to happen on multiple sheets, with the same format, and at the same time. So that all given worksheets will search a range for a given criteria and stack all of the results together in the same worksheet.
I know this is complicated, but it would make my workbook run so much more smoothly. I figured out code that will work for one worksheet and inserted that below as a starting point. Thank you for any help you can provide!
I am having some trouble writing a macro that will search sheet full of data, find cells that match a given criteria, copy other cells in the same row as the cell that matches the criteria, and then paste those cells in the same row on a different sheet. I need all the matching rows of cells to stack downward.
The tough part about this is that I need this same thing to happen on multiple sheets, with the same format, and at the same time. So that all given worksheets will search a range for a given criteria and stack all of the results together in the same worksheet.
I know this is complicated, but it would make my workbook run so much more smoothly. I figured out code that will work for one worksheet and inserted that below as a starting point. Thank you for any help you can provide!
Code:
Sub MoveData()
nextrow = 1
For x = 4 To 104
If Worksheets("Sheet1").Cells(x, 4).Value > 0 Then
Worksheets("Sheet2").Cells(nextrow, 2).Resize(1, 12).Value = _
Worksheets("Sheet1").Cells(x, 2).Resize(1, 12).Value
nextrow = nextrow + 1
End If
Next x
End Sub