Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Select Range using variables

I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Select Range using variables

Nevermind. I answered my own question.

ActiveCell.Range(Cells(1, 1), Cells(16, MyMonths)).Select



"StephanieH" wrote:

I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Select Range using variables

Define "variable number of columns to the left". Back to Column A or ??? If
Column A then...

dim rngTo Select as range
dim wks as worksheet

set wks = activesheet
set rngtoSelect = wks.range(activecell, .cells(activecell.row + 16, "A"))

rngtoselect.select
--
HTH...

Jim Thomlinson


"StephanieH" wrote:

I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Select Range using variables

Activecell.Offset().MyMonths).Resize(16,MyMonths). Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"StephanieH" wrote in message
...
I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Select Range using variables

I thought I had it before, but only close.

It's working now. Thanks Bob and Jim.



"Bob Phillips" wrote:

Activecell.Offset().MyMonths).Resize(16,MyMonths). Select

--

HTH

RP
(remove nothere from the email address if mailing direct)


"StephanieH" wrote in message
...
I need to select a range from the active cell 16 rows down and a variable
number of columns to the left. I've named my variable "MyMonths", but I'm
not sure how to incorporate it into a range address.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I select on two variables in a range of data in excel Jeff Excel Worksheet Functions 7 September 13th 05 01:10 AM
Select one variable from a list of variables by clicking one cell Curt Excel Discussion (Misc queries) 2 July 21st 05 01:44 AM
Range.Select Using Variables - need syntax gradientS Excel Discussion (Misc queries) 3 February 16th 05 12:45 PM
VBA-Select several ranges using variables waveracerr[_8_] Excel Programming 2 February 10th 04 11:12 PM
Using variables to select a range Marc[_14_] Excel Programming 1 November 29th 03 02:36 AM


All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"