Solved

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

Posted on 2014-10-29
3
58 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

734 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