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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,215,339
Messages
6,124,375
Members
449,155
Latest member
ravioli44

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