cell range

  • Thread starter Thread starter George
  • Start date Start date
G

George

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
 
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
 
JW:

Thanks.

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

I appreciate
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top