Copy excel cells using access

Tangent

New Member
Joined
Jan 16, 2005
Messages
5
I get "Run-time error '1004' Unable to get the PasteSpecial property of the Range class" when it gets to the following line of code

xlSheet.Range(xlSheet.Cells(xlRowSelect, 1), xlSheet.Cells(xlRowSelect, 26)).Copy xlSheet.Range(xlSheet.Cells(xlRowSelect + 1, 1), xlSheet.Cells(xlRowSelect + 1, 26)).PasteSpecial(xlPasteFormats)

I gather I am using the Copy and Paste Special method incorrectly but can't figure out how. Any ideas how to fix it or how to do a Autofill for the cell formatting instead?
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try putting the PasteSpecial on a different line.
Code:
xlSheet.Range(xlSheet.Cells(xlRowSelect, 1), xlSheet.Cells(xlRowSelect, 26)).Copy 

xlSheet.Range(xlSheet.Cells(xlRowSelect + 1, 1), xlSheet.Cells(xlRowSelect + 1, 26)).PasteSpecial(xlPasteFormats)
 
Upvote 0

Forum statistics

Threads
1,221,845
Messages
6,162,350
Members
451,760
Latest member
samue Thon Ajaladin

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