Copy and Paste specific data vba code

erimhast83

New Member
Joined
Jan 3, 2018
Messages
14
In the below code I am trying to look through my data for a specific name and then cut that data and paste it into a specific cell but I am getting an error on the last line. the error states: runtime error 438 object doesn't support this property or method. Can anyone help me see what I am missing? Thank you!


Sheets("Raw Data").Select
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "A").Value) = "SLEEPER,MELISSA" Then

Cells(i, "A").Cut
Cells(i + 2, 16).Paste
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try this:

Code:
Sub Copy_Me()
Application.ScreenUpdating = False
Sheets("Raw Data").Select
Last = Cells(Rows.Count, "A").End(xlUp).Row
    For i = Last To 1 Step -1
        If Cells(i, "A").Value = "SLEEPER,MELISSA" Then Cells(i, "A").Cut Cells(i + 2, 16)
    Next
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Try this:

Code:
Sub Copy_Me()
Application.ScreenUpdating = False
Sheets("Raw Data").Select
Last = Cells(Rows.Count, "A").End(xlUp).Row
    For i = Last To 1 Step -1
        If Cells(i, "A").Value = "SLEEPER,MELISSA" Then Cells(i, "A").Cut Cells(i + 2, 16)
    Next
Application.ScreenUpdating = True
End Sub


Thank you - this worked. I have one more question - what if I didn't want to use a specific person's name but I wanted to find words instead of numbers (the numbers are stored as text from the file I pull). How would the code change to do that? I might not have the same employees every time I pull the report.
 
Upvote 0

Forum statistics

Threads
1,214,589
Messages
6,120,416
Members
448,960
Latest member
AKSMITH

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