Object Required Error - Finding Last Row in Column

SAMCRO2014

Board Regular
Joined
Sep 3, 2015
Messages
160
Hi,

I cannot determine why I am getting the error "Object required" for the following coding for LastRowText:

Set variables
Dim PPDR As Worksheet
Set PPDR = ThisWorkbook.Sheets("PPDR")

Dim SPS As Worksheet
Set SPS = ThisWorkbook.Sheets("SPS+")

Dim Data As Worksheet
Set Data = ThisWorkbook.Sheets("Data")

Dim LastRowText As Long
Set LastRowText = PPDR.Cells(Rows.Count, "P").End(xlUp).Row

I am trying to determine the last row of cells that contain data in column P for worksheet PPDR.
HELP!!
 
In that case it did work ;)
That's what that line of code is meant to do.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
The coding over wrote information in column M when it should not.
That is also what your code would have done if it had worked since it was also trying to Paste starting at M2.
Range("P2:LastRowText").Copy_destination = PPDR.Range("M2")
Did you mean for it to be pasted below the existing data in column M?
Code:
PPDR.Range("P2:P" & LastRowText).Copy Destination:=PPDR.Range("M" & PPDR.Rows.Count).End(xlUp).Offset(1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,903
Messages
6,181,648
Members
453,059
Latest member
jkevin

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
Back
Top