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 ?
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

footoo

Well-known Member
Joined
Sep 21, 2016
Messages
3,030
Office Version
2016
Platform
Windows
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]
 

mrchonginhk

Well-known Member
Joined
Dec 3, 2004
Messages
679
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:

footoo

Well-known Member
Joined
Sep 21, 2016
Messages
3,030
Office Version
2016
Platform
Windows
I don't understand what you want to do.
 

mrchonginhk

Well-known Member
Joined
Dec 3, 2004
Messages
679
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 ?
 

footoo

Well-known Member
Joined
Sep 21, 2016
Messages
3,030
Office Version
2016
Platform
Windows
Perhaps :
Enter in A1:A100 =$B$1
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
45,094
Office Version
365
Platform
Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,101,754
Messages
5,482,694
Members
407,358
Latest member
Maze123

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top