Copy Pasting multiple columns

R

robo87

Hello there,

I'm new to applescript so it might sound silly.

I've got problem with pasting from one document (source) to another (target)
different columns. The nightmare begins when code is getting to the part when
it needs to go to the next column and copy it and it just doesn't want to
copy or paste it.

tell application "Microsoft Excel"
activate
open source
activate object workbook source
select range "I:I" of sheet 1 of workbook source
copy range (range "I:I" of sheet 1 of workbook source)
open target
activate object workbook target
select (range "B2")
paste worksheet sheet 1 destination range "B2:B" of workbook target
delay 2
set the clipboard to ""

activate object workbook source
activate object sheet 1
select range "A:A" of sheet 1 of workbook source
copy range (range "A:A" of sheet 1 of workbook source)
activate object workbook target
activate object sheet 1
select (range "D2")
paste worksheet sheet 1 destination range "D2:D" of workbook target
delay 2
set the clipboard to ""
end tell

Maybe there's solution for doing that in a different way?
Thanks in advance

Robo
 
B

Bob Greenblatt

Hello there,

I'm new to applescript so it might sound silly.

I've got problem with pasting from one document (source) to another (target)
different columns. The nightmare begins when code is getting to the part when
it needs to go to the next column and copy it and it just doesn't want to
copy or paste it.

tell application "Microsoft Excel"
activate
open source
activate object workbook source
select range "I:I" of sheet 1 of workbook source
copy range (range "I:I" of sheet 1 of workbook source)
open target
activate object workbook target
select (range "B2")
paste worksheet sheet 1 destination range "B2:B" of workbook target
delay 2
set the clipboard to ""

activate object workbook source
activate object sheet 1
select range "A:A" of sheet 1 of workbook source
copy range (range "A:A" of sheet 1 of workbook source)
activate object workbook target
activate object sheet 1
select (range "D2")
paste worksheet sheet 1 destination range "D2:D" of workbook target
delay 2
set the clipboard to ""
end tell

Maybe there's solution for doing that in a different way?
Thanks in advance

Robo
I don't know what "it just doesn't want to copy or paste it" means. Do
you get an error? If so, what error? If not, what happens, exactly" You
should open both files before you sttart to select and copy.
 

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

Top