Sending Multiple Ranges in Textbody

Microsoft Office excel 2007 home & stude...
July 12, 2010 at 01:33:55
Specs: Windows XP

i have a code that sends certain range of excel (e.g. "A1:D15") to the textbody of the outlook and and displays it as a table, now what i wanted to do is to send multiple ranges of the excel database into the textbody.

to make it clear, what i wanted to do is to lets say if cell E1 = 1 send the range E2:F5 and if E1 = 2 send the range M1:N6. i know there is some other way than what i am thinking of.. easier way.. if you need me to post my codes please just tell me.

thanks in advance!

See More: Sending Multiple Ranges in Textbody

July 12, 2010 at 05:28:39

As you haven't posted the code you are using to 'send' your range, I can't suggest actual changes.

You could use the Select Case ... End Select structure, something like this:

Select Case Worksheets("Sheet1").Range("E1").Value
    Case 1
        'send range A1:B10
    Case 2
        'send range C1:D10
    Case Else
        'send the default range if E1 does not contain
        'one of the expected values
        'send range X1:Y10
End Select

Note that in this example the code following Case 1 will be run if cell E1 contains the value 1 and any code following Case 2 will be run if cell E2 contains 2


Report •
Related Solutions

Ask Question