ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell range (https://www.excelbanter.com/excel-programming/411722-cell-range.html)

George

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

JW[_2_]

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

George

cell range
 
JW:

Thanks.

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

I appreciate

Per Jessen

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



George

cell range
 
Jessen:

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



All times are GMT +1. The time now is 05:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com