PC Review


Reply
Thread Tools Rate Thread

Copy two ranges without the interval rows to the email

 
 
chelsea
Guest
Posts: n/a
 
      26th Jun 2008
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


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      26th Jun 2008
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



"chelsea" wrote:

> 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
>
>
>

 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      26th Jun 2008
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


"chelsea" wrote:

> 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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy ranges in sets of 30 rows into separate worksheet tabs inworkbook Financeguy Microsoft Excel Programming 5 12th Jul 2009 06:05 PM
Copy ranges into email - HTLM and Text format fLiPMoD£ Microsoft Outlook 2 7th Nov 2007 01:59 PM
Copy ranges into email - HTLM and Text format fLiPMoD£ Microsoft Excel Discussion 2 7th Nov 2007 01:59 PM
Copy ranges into email - HTLM and Text format fLiPMoD£ Microsoft Excel Programming 2 7th Nov 2007 01:59 PM
Using macro/vba to copy varying ranges of rows =?Utf-8?B?QkNMaXZlbGw=?= Microsoft Excel Misc 3 6th Jun 2007 02:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:59 PM.