Solved

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

Posted on 2014-10-29
3
52 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:Iammontoya
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now