Range Select Error

  • Thread starter Thread starter sailingdan
  • Start date Start date
S

sailingdan

I’m having trouble selecting a range of cells on one sheet and copyin
them to another. I’ve tried using the tried and true method o
recording a macro and pasting the code to a command button where I wan
it… and even this idea has failed me.

Windows("AQWA002.CSV").Activate
Range("B7:B9840").Select
Selection.Copy
Windows("0510.xls").Activate
Range("C31").Select
ActiveSheet.Paste

I keep getting a ‘Select method of Range class failed’ error at th
second line.

Can somebody explain why this doesn’t work and what I need to do to fi
it?

Thanks
 
Not sure why you are having trouble.

But try the below code. Be sure to fill in the sheet names (or index
number).
Note that no selection is required. And watch out for the line continuation
after ".Copy _"
'''''''''''''''''''''''''''''''''''
Workbooks("AQWA002.CSV").Sheets(?).Range("B7:B9840").Copy _
Destination:=Workbooks("0510.xls").Sheets(??).Range("C31")
'''''''''''''''''''''''''''''''''''
hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top