#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default cell range

Hi, all:

I need to define a cell range which always starts with cell A3 and
have a known number of cells. For example, if I know the number of
cells to be included in this cell range is 5, the cell range will be
A3:A8. and if I know the number of cells to be included in this cell
range is 10, then the cell range will be A3:A13. I do not want to
exclude blank cells within the cell range.

Please advise,

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default cell range

On May 29, 1:25*pm, George wrote:
Hi, all:

I need to define a cell range which always starts with cell A3 and
have a known number of cells. For example, if I know the number of
cells to be included in this cell range is 5, the cell range will be
A3:A8. and if I know the number of cells to be included in this cell
range is 10, then the cell range will be A3:A13. I do not want to
exclude blank cells within the cell range.

Please advise,

Thanks


Sub oneWay()
Dim num As Integer
num = 5
Range("A3").Resize(num + 1).Select
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default cell range

JW:

Thanks.

Is there anyway I can insert this as a Name? Excel Menu Bar\Insert\Name
\Define

I appreciate
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default cell range

Hi


Dim TargetRange As Range
Dim num As Integer
num = 5
set TargetRange=Range("A3").Resize(num + 1)
ActiveWorkbook.Names.Add Name:="MyName", RefersTo :=TargetRange

Regards,
Per

"George" skrev i meddelelsen
...
JW:

Thanks.

Is there anyway I can insert this as a Name? Excel Menu Bar\Insert\Name
\Define

I appreciate


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default cell range

Jessen:

It is perfect. Thank you so much for your help!

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
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Excel Programming 2 July 8th 07 04:18 PM
loop through cells in a range and pick up corresponding cell values in another range [email protected] Excel Programming 9 October 19th 06 05:11 AM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Change cell colour for a cell or range within a predefined range Martin[_21_] Excel Programming 2 May 23rd 05 06:16 PM
Range.Find returns cell outside of range when range set to single cell Frank Jones Excel Programming 12 June 10th 04 04:22 AM


All times are GMT +1. The time now is 06:05 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"