why is copy and paste so tricky with vba?

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,056
Office Version
  1. 365
Platform
  1. Windows
maybe its just me? anyhoo, i have a routine which opens another workbook, moves the data around and adds an autofilter. It should then copy the autofiltered range back to my source workbook.

Code:
With ESMwb.ActiveSheet.AutoFilter.Range
    .Offset(1, 0).Resize(.Rows.Count - 1).Copy
    Sourcewb.MainWS.Range("A" & LastRow + 1).PasteSpecial
    End With

I get "Run-time error 438: Object doesn't support this property or method" on the Sourcewb.MainWS... line

what is the correct syntax please?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
@ajm....so it works now ???

sorry Michael. Yes it does. I have to do some reading (in all my spare time!....) on the when to use what with copy and paste. Its my achilles heel for some reason. thanks all for your help.
 
Upvote 0
yeah, I agree copy / paste special.....always used to do my head in....:beerchug:
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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