Invalid Qualifier compile error? Not sure why!

trillium

Board Regular
Joined
Aug 9, 2010
Messages
63
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....

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
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try like this

Code:
Range(PRLastCell).PasteSpecial Paste:=xlPasteValues
 
Upvote 0

trillium

Board Regular
Joined
Aug 9, 2010
Messages
63
[SOLVED] Re: Invalid Qualifier compile error? Not sure why!

AWESOME! that sets me in the right direction! I found some other things I needed to tweak but this solved that issue! THANK YOU!!
 
Upvote 0

trillium

Board Regular
Joined
Aug 9, 2010
Messages
63
[SOLVED] Re: Invalid Qualifier compile error? Not sure why!

opps Just put the SOLVED on the title I think! Thanks again! :biggrin:
 
Upvote 0

Forum statistics

Threads
1,191,557
Messages
5,987,269
Members
440,087
Latest member
Ruppert23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top