So it has been a while and I was never a pro at this, but here's my code and what's happening.
Things are going well and the first instance found is pasted in the correct position, but the subsequent pastings are put in the first row (see screen shots). I am using PasteSpecial b/c Paste would not work; I got the error "Object does not support this property or method." Maybe the pasting is my problem.
Also, I would like to insert the data if it is not found in the other sheet. It will be sorted numerically by column A. I have not even researched possible solutions to this one.
Further, any suggestions on cleaning/simplifying the code are appreciated.
Things are going well and the first instance found is pasted in the correct position, but the subsequent pastings are put in the first row (see screen shots). I am using PasteSpecial b/c Paste would not work; I got the error "Object does not support this property or method." Maybe the pasting is my problem.
Also, I would like to insert the data if it is not found in the other sheet. It will be sorted numerically by column A. I have not even researched possible solutions to this one.
Further, any suggestions on cleaning/simplifying the code are appreciated.
Code:
Sub RoundedRectangle1_Click()
Dim recent As Worksheet
Dim original As Worksheet
Dim criteria As String
Dim count As Integer
Set recent = Worksheets("Recent")
Set original = Worksheets("Invoices")
recent.Select
recent.Range("A1").Select
Do Until IsEmpty(ActiveCell)
criteria = ActiveCell.Value
original.Select
original.Range("A1").Select
Do Until IsEmpty(ActiveCell)
If criteria = ActiveCell.Value Then
recent.Select
recent.Range(ActiveCell, ActiveCell.Offset(0, 2)).Select
Selection.Copy
original.Select
original.Cells(ActiveCell).PasteSpecial
count = count + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
recent.Select
ActiveCell.Offset(1, 0).Select
Loop
End Sub