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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

footoo

Well-known Member
Joined
Sep 21, 2016
Messages
3,039
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,039
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,039
Office Version
2016
Platform
Windows
Perhaps :
Enter in A1:A100 =$B$1
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
45,245
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,102,630
Messages
5,487,990
Members
407,617
Latest member
Samanthad2007

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top