Hi! I'm trying (in vain.... ) to write a code that will copy a range from one sheet (source) to another (Destination) This part I can do.
BUT... first it checks for a unique identifier to see if that entry already exists. The unique identifier is at the beginning of each range.
I seem to be able to get it all, except the step right after it identifies the last cell and checks the unique identifiers and determines they are the same or not... I can't get it to PASTE?! I get a "Invalid Qualifier compile error" (see red below).
I'm sure it's a super simple thing I'm missing (like a "." or something). But its driving me mad....
BUT... first it checks for a unique identifier to see if that entry already exists. The unique identifier is at the beginning of each range.
I seem to be able to get it all, except the step right after it identifies the last cell and checks the unique identifiers and determines they are the same or not... I can't get it to PASTE?! I get a "Invalid Qualifier compile error" (see red below).
I'm sure it's a super simple thing I'm missing (like a "." or something). But its driving me mad....
Rich (BB code):
Sub CopyPRData()
Dim intAuditPR As String 'from Source Sheet
Dim PRLastCell As String 'on PRHistory Sheet (Destination)
Dim rng As Range 'range of cells to copy to Desitination sheet
intAuditPR = Sheets("PeerReview").Range("AJ4").Value
Set rng = Range("AJ4:FC4").Find(What:=intAuditPR, LookIn:=xlValues, LookAt:=xlWhole)
PRLastCell = Sheets("PRHistory").Range("A600").End(xlUp).Address 'yes, I meant to tell it only 600 then up
If intAuditPR = PRLastCell Then
rng.Copy 'copies the range
PRLastCell.Select 'pastes it over the existing entry. This is where I get the the invaild property error
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Else
rng.Copy
PRLastCell.Offset(1, 0).Select 'pastes it after the existing entry (This is where I get the the invaild property error)
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End If
End Sub