Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
DJS DJS is offline
external usenet poster
 
Posts: 31
Default Setting Range Dynamically

Hello, I am trying to set Range dynamically with a variable and just can't
seem to figure out the proper method. Any help greatly appreciated. Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that would be
appreciated also!

Here is my code snippet which does not seem to properly define the range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2, colNum)).End(xlDown))

TIA
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Setting Range Dynamically

On the up side you are really close... Try this...

Set rng = Range(Cells(2, colNum), Cells(2, colNum).End(xlDown))
--
HTH...

Jim Thomlinson


"DJS" wrote:

Hello, I am trying to set Range dynamically with a variable and just can't
seem to figure out the proper method. Any help greatly appreciated. Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that would be
appreciated also!

Here is my code snippet which does not seem to properly define the range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2, colNum)).End(xlDown))

TIA

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Setting Range Dynamically

Colnum = 5
Set rng = Range(Cells(2, Colnum), Cells(2, Colnum).End(xlDown))

just put the "down" reference in the range function.
--
Gary's Student


"DJS" wrote:

Hello, I am trying to set Range dynamically with a variable and just can't
seem to figure out the proper method. Any help greatly appreciated. Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that would be
appreciated also!

Here is my code snippet which does not seem to properly define the range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2, colNum)).End(xlDown))

TIA

  #4   Report Post  
Posted to microsoft.public.excel.misc
DJS DJS is offline
external usenet poster
 
Posts: 31
Default Setting Range Dynamically

Thanks Jim, I tried that (still have it commented out) but now it works like
a charm. BTW: Do you know how to echo out to the msg window the Range whch
will be used? I tried the following but doesn't seem to work:

MsgBox "The selected Range is " & rng.Text

Thanks again.

"Jim Thomlinson" wrote:

On the up side you are really close... Try this...

Set rng = Range(Cells(2, colNum), Cells(2, colNum).End(xlDown))
--
HTH...

Jim Thomlinson


"DJS" wrote:

Hello, I am trying to set Range dynamically with a variable and just can't
seem to figure out the proper method. Any help greatly appreciated. Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that would be
appreciated also!

Here is my code snippet which does not seem to properly define the range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2, colNum)).End(xlDown))

TIA

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,726
Default Setting Range Dynamically

MsgBox "The selected Range is " & rng.Address

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"DJS" wrote in message
...
Thanks Jim, I tried that (still have it commented out) but now it works
like
a charm. BTW: Do you know how to echo out to the msg window the Range whch
will be used? I tried the following but doesn't seem to work:

MsgBox "The selected Range is " & rng.Text

Thanks again.

"Jim Thomlinson" wrote:

On the up side you are really close... Try this...

Set rng = Range(Cells(2, colNum), Cells(2, colNum).End(xlDown))
--
HTH...

Jim Thomlinson


"DJS" wrote:

Hello, I am trying to set Range dynamically with a variable and just
can't
seem to figure out the proper method. Any help greatly appreciated.
Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that
would be
appreciated also!

Here is my code snippet which does not seem to properly define the
range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2,
colNum)).End(xlDown))

TIA





  #6   Report Post  
Posted to microsoft.public.excel.misc
DJS DJS is offline
external usenet poster
 
Posts: 31
Default Setting Range Dynamically

Thank you!

"Bob Phillips" wrote:

MsgBox "The selected Range is " & rng.Address

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"DJS" wrote in message
...
Thanks Jim, I tried that (still have it commented out) but now it works
like
a charm. BTW: Do you know how to echo out to the msg window the Range whch
will be used? I tried the following but doesn't seem to work:

MsgBox "The selected Range is " & rng.Text

Thanks again.

"Jim Thomlinson" wrote:

On the up side you are really close... Try this...

Set rng = Range(Cells(2, colNum), Cells(2, colNum).End(xlDown))
--
HTH...

Jim Thomlinson


"DJS" wrote:

Hello, I am trying to set Range dynamically with a variable and just
can't
seem to figure out the proper method. Any help greatly appreciated.
Plus, if
someone knows a great tutorial on how to use Range, Cells, etc that
would be
appreciated also!

Here is my code snippet which does not seem to properly define the
range
(Note: My var, colNum, is properly populating the column number field):

Set rng = Range(Range(Cells(2, colNum)), Range(Cells(2,
colNum)).End(xlDown))

TIA




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
Dynamic Ranges using non-contiguous cells and dependent on a cell value Carlo Paoloni Excel Worksheet Functions 2 November 29th 06 07:29 PM
Setting a default sort for a range cHris New Users to Excel 2 April 26th 06 09:32 AM
dynamically select a range of cells for use in a formula isofuncurves Excel Worksheet Functions 1 February 2nd 06 01:34 AM
Setting source data range with Charts D Charts and Charting in Excel 2 January 1st 06 02:51 AM
How can I dynamically eliminate blank cells in a given range in E. Scott Steele Excel Worksheet Functions 6 December 17th 04 03:23 AM


All times are GMT +1. The time now is 07:53 AM.

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"