OfficeUser
Well-known Member
- Joined
- Feb 4, 2010
- Messages
- 544
- Office Version
- 365
- 2016
- Platform
- Windows
I am using this code to copy any rows in Sheet 1 with a value in B:B to Sheet 2. I altered the code so far to suit my needs but I only need to copy the date from Column A and B from Sheets 1 and paste into Sheet 2, not the entire row. Anyone know how to do this? I assume I need to change matchRow to something else... THANKS!!
Code:
Sub Test()
'Copies values from row if designated value is found in Column B
Sheets("Sheet1").Select
For Each Cell In Sheets("Sheet1").Range("B:B")
If Cell.Value > "" Then
matchRow = Cell.Row
Rows(matchRow & ":" & matchRow).Select
Selection.Copy
'Pastes values to next empty Row
Sheets("Sheet2").Select
Sheets("Sheet2").Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
End If
Next
End Sub
Last edited: