How to create a range from a cell value and repeat time in another cell ?

mrchonginhk

Well-known Member
Joined
Dec 3, 2004
Messages
679
Right now I have a data A1:A100 each cell is 500
So my range called RangeA is A1:A100
Can I do without need to have this list in this 100 rows



Now I key in, B1=500, C1=100
How can I create RangeA based on these two cell values ?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
If you mean you want to copy the value in B1 and enter it from A1 down to the row number in C1, and then create a named range ("RangeA") which refers to the rows with data in column A :
Code:
Dim rng$: rng = "RangeA"
On Error Resume Next
ActiveWorkbook.Names(rng).Delete
On Error GoTo 0
ActiveWorkbook.Names.Add Name:=rng, RefersTo:="=Sheet1!$A$1:$A$" & [C1]
Range("A2:A" & Cells(Rows.Count, "A").End(3).Row).ClearContents
Range(rng).Value = [B1]
 
Upvote 0
Thanks. I forget I cannot use VBA in the company.

How to do it without VBA ? Will array work ?
Those 500 are fixed and do not change.
 
Last edited:
Upvote 0
Basically I mean I need to create a range of 100 cells each is the same "500"
How to do this using cell value 500 and 100 ?
 
Upvote 0
Now I key in, B1=500, C1=100
How can I create RangeA based on these two cell values ?
Try in A1, Copied down as far as you might ever need

=IF(ROWS(A$1:A1)>C$1,"",B$1)

Now try changing B1 and/or C1 and look at the new values in column A.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,150
Members
448,552
Latest member
WORKINGWITHNOLEADER

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top