combining information from 2 ranges

Posted on 2007-07-21
Medium Priority
Last Modified: 2010-04-23
I have a VB,NET 2005 application.
It uses Excel Automation
I have 2 ranges:

oRange1 = oSheet.Range("A23:A29")
oRange2 = oSheet.Range("E20:E:26")

And a subroutine
Private Sub PrintValues(ByVal  MyRange As Range)

I need to concatenate the two ranges into one range in order to be able to use the subroutine

How do I acomplish that ?

A simple way to visualize it would be
oRange = oRange1 + oRange2
oRange = oRange1 & oRange2

I understand that this might be a problem because the ranges might have diffrent dimensions.

How can i do it if I know that each oRange is a 1 column range ?
How can I copy the information into such new range containing all the data ?

Question by:Mafalda
1 Comment
LVL 10

Accepted Solution

athapa earned 200 total points
ID: 19540639
Use Application.Union method to combine your ranges


Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question