Needinghlp
New Member
- Joined
- Feb 27, 2013
- Messages
- 25
Hi all,
Hoping someone might be able to offer some guidance. I have 2 worksheets (sheet1 & sheet2). Sheet 2 contains a list of dates in column O.
I am trying to create some code that will identify dates after 30/06/2021 on sheet2, copy the relevant row and paste it to sheet1.
Below is the code I have. I've also tried putting 30/06/2021 in a reference cell (BB1) and used this line of code instead of whats below, but that doesn't work either: If Worksheets("Sheet2").Cells(i, 15).Value > ("BB1") Then
Private Sub CommandButton10_Click()
A = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To A
If Worksheets("Sheet2").Cells(i, 15).Value > 30 / 6 / 2021 Then
Worksheets("Sheet2").Rows(i).Copy
Worksheets("Sheet1").Activate
b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet1").Cells(b + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End If
Next
End Sub
Hoping someone might be able to offer some guidance. I have 2 worksheets (sheet1 & sheet2). Sheet 2 contains a list of dates in column O.
I am trying to create some code that will identify dates after 30/06/2021 on sheet2, copy the relevant row and paste it to sheet1.
Below is the code I have. I've also tried putting 30/06/2021 in a reference cell (BB1) and used this line of code instead of whats below, but that doesn't work either: If Worksheets("Sheet2").Cells(i, 15).Value > ("BB1") Then
Private Sub CommandButton10_Click()
A = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
For i = 3 To A
If Worksheets("Sheet2").Cells(i, 15).Value > 30 / 6 / 2021 Then
Worksheets("Sheet2").Rows(i).Copy
Worksheets("Sheet1").Activate
b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet1").Cells(b + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End If
Next
End Sub