Copy two ranges without the interval rows to the email

C

chelsea

Hi,

what i intend to do is that i just want to copy two
ranges(range("A1:L2"),rng2=("A5:L5")) from excel to an email.
i use the vba as below:
union(range("A1:L2"),rng2=("A5:L5")).copy
it can get the right result in the excel,while i paste it in the email it
display the whole range("a1:l5").
i am very confused about why it get the different result£¿

can anybody give a guide?

Regards,
Chelsea
 
J

Joel

To help debug these type problems I sometimes resort to SELECTION.

I would do
union(range("A1:L2"),rng2=("A5:L5")).select

Then look at the worksheet to see what is selected.

Then try

set CopyRange = union(range("A1:L2"),rng2=("A5:L5"))
CopyRange.Select

And see if the same results occur. If this is correct then you can replace
your code with

set CopyRange = union(range("A1:L2"),rng2=("A5:L5"))
CopyRange.Copy
 
J

Joel

I just noticed the rng2. I think this should be

from
union(range("A1:L2"),rng2=("A5:L5")).copy

to
union(range("A1:L2"),rng2:=Range("A5:L5")).copy

or just
union(range("A1:L2"),range("A5:L5")).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