Solved

Selecting a range, defining it to use later in a procedure.

Posted on 2014-10-29
3
56 Views
Last Modified: 2014-10-29
I am copying 500 rows of data.  How would I recall these to use later in a procedure?
Could I use: RangeToUseLater = ??

Range(ActiveCell, ActiveCell.Offset(499, 0)).Copy

I need to run a few other thing before I get the range.  Or do I need to re-org the sequence so I get it when I need it?
0
Comment
Question by:RWayneH
3 Comments
 
LVL 19

Expert Comment

by:Montoya
ID: 40410983
you can simply name the range, and use it later in a formula, etc...
0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40411119
Dimension a range variable then assign this range to it like so:
Option Explicit
Dim rng as Range

Sub MyProcedure()
.
.
.
Set rng = Range(ActiveCell, ActiveCell.Offset(499, 0))
.
'do other stuff
.
.
rng.Copy
.
'
.
End Sub

Open in new window


If you're range is on a different sheet than the destination, you'll want to define the range as part of that specific worksheet.

Regards,
-Glenn
0
 

Author Closing Comment

by:RWayneH
ID: 40412375
Thanks for the help
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

821 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