Hello,
I am trying to alter code that was posted by another user here, So that instead of copying an entire row to a new sheet, it copies one offset cell, to another offset cell on the corresponding sheet.
So instead of copying a row with FiftySevens to NewWSLrow, it will copy only the F column cell of that row, to the first empty cell in Column C of the new worksheet. I hope that makes sense. I'm still very new to using and altering VBA code
Thanks in advance for any help!!
I am trying to alter code that was posted by another user here, So that instead of copying an entire row to a new sheet, it copies one offset cell, to another offset cell on the corresponding sheet.
So instead of copying a row with FiftySevens to NewWSLrow, it will copy only the F column cell of that row, to the first empty cell in Column C of the new worksheet. I hope that makes sense. I'm still very new to using and altering VBA code
Thanks in advance for any help!!
VBA Code:
For Each WS In ActiveWorkbook.Worksheets 'This line starts the loop through each sheet
If WS.Name <> NewWs.Name Then
lrow = WS.Cells(Rows.Count, 2).End(xlUp).Row
For i = 4 To 27 'x to x represents the row the data starts and ends in. This line starts the loop to look through the product in each sheet
If WS.Cells(i, 2) = FiftySevens Then
NewWsLrow = NewWs.Cells(Rows.Count, 2).End(xlUp).Row
WS.Cells(i, 2).EntireRow.Copy NewWs.Cells(NewWsLrow + 1, 2).EntireRow 'If the loop finds the product name, then paste it to the new sheet
NewWs.Cells(NewWsLrow + 1, 9) = WS.Name 'Add in the name of the sheet the data is coming from
End If
Next i
End If
Next WS