Generate list of numbers between start and end value

S

Sinner

Hi,

This should be simple.

I have a start value in one cell and end value in another.
I want to generate a list between them.

Start value: 8597000098881
End value: 8597000098890

Result:

8597000098881
8597000098882
8597000098883
8597000098884
8597000098885
8597000098886
8597000098887
8597000098888
8597000098889
8597000098890

Any idea?
 
G

Guest

Startvalue in A1, Endvalue in B1

Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub


"Sinner" skrev:
 
O

Otto Moehrbach

Put the first number in one cell.
With that cell selected, hold the Ctrl key down and drag that cell down as
far as you want. What you see will be in scientific notation because of the
large number of digits but the numbers you want will be visible in the
formula bar. HTH Otto
 
S

Sinner

Startvalue in A1, Endvalue in B1

Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

"Sinner" skrev:


This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890


Any idea?- Hide quoted text -

- Show quoted text -

excelent this is giving an error.
 
G

Guest

ok then try add sheet name - change Sheet1 to your sheetname

Sub myFill1()
Sheets("Sheet1").Activate
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

or

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1") -
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub



"Sinner" skrev:
Startvalue in A1, Endvalue in B1

Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

"Sinner" skrev:


This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890


Any idea?- Hide quoted text -

- Show quoted text -

excelent this is giving an error.
 
S

Sinner

ok then try add sheet name - change Sheet1 to your sheetname

Sub myFill1()
Sheets("Sheet1").Activate
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

or

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1") -
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub

"Sinner" skrev:


Startvalue in A1, Endvalue in B1
Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:
Hi,
This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890
Result:
8597000098881
8597000098882
8597000098883
8597000098884
8597000098885
8597000098886
8597000098887
8597000098888
8597000098889
8597000098890
Any idea?- Hide quoted text -
- Show quoted text -
excelent this is giving an error.- Hide quoted text -

- Show quoted text -
------------------------------------------------------------------------------------

'_' was missing : ) now it is correct but still giving error.

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1")
- _
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub

It says,

"Autofill method of range class failed."
 
D

Dana DeLouis

I have a start value in one cell and end value in another.
I want to generate a list between them.

Another option I like is "DataSeries."

A1 = Start Number
B1 = End Number

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Stop:=[B1], _
Trend:=False
End Sub


One advantage of DataSeries I believe is that the Algorithm is a little
different. For example, if the step were other than 1 (say 0.1) you will
have more "exact" values than if you drag down. There were a few old
Microsoft kb articles on this.
 
S

Sinner

I have a start value in one cell and end value in another.
I want to generate a list between them.

Another option I like is "DataSeries."

A1 = Start Number
B1 = End Number

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Stop:=[B1], _
Trend:=False
End Sub

One advantage of DataSeries I believe is that the Algorithm is a little
different. For example, if the step were other than 1 (say 0.1) you will
have more "exact" values than if you drag down. There were a few old
Microsoft kb articles on this.
--
Dana DeLouis




This should be simple.
I have a start value in one cell and end value in another.
I want to generate a list between them.
Start value: 8597000098881
End value: 8597000098890


Any idea?- Hide quoted text -

- Show quoted text -

Dear Dana,

This works but numbers are changed to scientific notation.
 
G

Guest

Line 1. Sub myFill2()
Line 2. Set sh = Sheets("Sheet1")
Line 3. sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" &
sh.Range("B1") - sh.Range("A1") + 1), Type:=xlFillSeries
Line 4. End Sub

anyway here is anotner construction :

Sub myFill3()
Set sh = Sheets("Sheet1")
rw = sh.Range("B1") - sh.Range("A1") + 1
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & rw), Type:=xlFillSeries
End Sub


"Sinner" skrev:
ok then try add sheet name - change Sheet1 to your sheetname

Sub myFill1()
Sheets("Sheet1").Activate
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

or

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1") -
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub

"Sinner" skrev:


On Sep 18, 1:44 am, excelent <[email protected]>
wrote:
Startvalue in A1, Endvalue in B1
Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:

This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890


Any idea?- Hide quoted text -
- Show quoted text -
excelent this is giving an error.- Hide quoted text -

- Show quoted text -
------------------------------------------------------------------------------------

'_' was missing : ) now it is correct but still giving error.

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1")
- _
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub

It says,

"Autofill method of range class failed."
 
D

Dana DeLouis

This works but numbers are changed to scientific notation.

Hi. Just a formatting fix. I guess with "Linear," we can remove the xlDay
part.

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Step:=1, _
Stop:=[B1], _
Trend:=False

With [A1].EntireColumn
.NumberFormat = "0"
.AutoFit
End With
End Sub

--
HTH :>)
Dana DeLouis


Sinner said:
I have a start value in one cell and end value in another.
I want to generate a list between them.

Another option I like is "DataSeries."

A1 = Start Number
B1 = End Number

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Stop:=[B1], _
Trend:=False
End Sub

One advantage of DataSeries I believe is that the Algorithm is a little
different. For example, if the step were other than 1 (say 0.1) you will
have more "exact" values than if you drag down. There were a few old
Microsoft kb articles on this.
--
Dana DeLouis




This should be simple.
I have a start value in one cell and end value in another.
I want to generate a list between them.
Start value: 8597000098881
End value: 8597000098890


Any idea?- Hide quoted text -

- Show quoted text -

Dear Dana,

This works but numbers are changed to scientific notation.
 
S

Sinner

Line 1. Sub myFill2()
Line 2. Set sh = Sheets("Sheet1")
Line 3. sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" &
sh.Range("B1") - sh.Range("A1") + 1), Type:=xlFillSeries
Line 4. End Sub

anyway here is anotner construction :

Sub myFill3()
Set sh = Sheets("Sheet1")
rw = sh.Range("B1") - sh.Range("A1") + 1
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & rw), Type:=xlFillSeries
End Sub

"Sinner" skrev:


ok then try add sheet name - change Sheet1 to your sheetname
Sub myFill1()
Sheets("Sheet1").Activate
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub
or
Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1") -
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:
On Sep 18, 1:44 am, excelent <[email protected]>
wrote:
Startvalue in A1, Endvalue in B1
Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:
Hi,
This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890
Result:
8597000098881
8597000098882
8597000098883
8597000098884
8597000098885
8597000098886
8597000098887
8597000098888
8597000098889
8597000098890
Any idea?- Hide quoted text -
- Show quoted text -
excelent this is giving an error.- Hide quoted text -
- Show quoted text - ---------------------------------------------------------------------------­---------

'_' was missing : ) now it is correct but still giving error.
Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1")
- _
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub
"Autofill method of range class failed."- Hide quoted text -

- Show quoted text -

Excelent it still says "Autofill method of range class failed."
 
S

Sinner

This works but numbers are changed to scientific notation.

Hi. Just a formatting fix. I guess with "Linear," we can remove the xlDay
part.

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Step:=1, _
Stop:=[B1], _
Trend:=False

With [A1].EntireColumn
.NumberFormat = "0"
.AutoFit
End With
End Sub

--
HTH :>)
Dana DeLouis




I have a start value in one cell and end value in another.
I want to generate a list between them.
Another option I like is "DataSeries."
A1 = Start Number
B1 = End Number
Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Stop:=[B1], _
Trend:=False
End Sub
One advantage of DataSeries I believe is that the Algorithm is a little
different. For example, if the step were other than 1 (say 0.1) you will
have more "exact" values than if you drag down. There were a few old
Microsoft kb articles on this.
--
Dana DeLouis

Hi,
This should be simple.
I have a start value in one cell and end value in another.
I want to generate a list between them.
Start value: 8597000098881
End value: 8597000098890
Result:
8597000098881
8597000098882
8597000098883
8597000098884
8597000098885
8597000098886
8597000098887
8597000098888
8597000098889
8597000098890
Any idea?- Hide quoted text -
- Show quoted text -
Dear Dana,
This works but numbers are changed to scientific notation.- Hide quoted text -

- Show quoted text -

Dear Dana,

Start Value is 8788007677800201790
End Value is 8788007677800201799

Not working for such length of figure.
 
G

Guest

http://pmexcelent.dk/myFill.xls



"Sinner" skrev:
Line 1. Sub myFill2()
Line 2. Set sh = Sheets("Sheet1")
Line 3. sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" &
sh.Range("B1") - sh.Range("A1") + 1), Type:=xlFillSeries
Line 4. End Sub

anyway here is anotner construction :

Sub myFill3()
Set sh = Sheets("Sheet1")
rw = sh.Range("B1") - sh.Range("A1") + 1
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & rw), Type:=xlFillSeries
End Sub

"Sinner" skrev:


On Sep 18, 8:12 am, excelent <[email protected]>
wrote:
ok then try add sheet name - change Sheet1 to your sheetname
Sub myFill1()
Sheets("Sheet1").Activate
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub

Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1") -
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:
On Sep 18, 1:44 am, excelent <[email protected]>
wrote:
Startvalue in A1, Endvalue in B1
Sub myFill()
[A1].AutoFill Destination:=Range("A1:A" & [B1] - [A1] + 1), Type:=xlFillSeries
End Sub
"Sinner" skrev:

This should be simple.
I have astartvaluein one cell and endvaluein another.
I want togeneratealistbetweenthem.
Startvalue: 8597000098881
Endvalue: 8597000098890


Any idea?- Hide quoted text -
- Show quoted text -
excelent this is giving an error.- Hide quoted text -
- Show quoted text -
-------------------------------------------------------------------------------------
'_' was missing : ) now it is correct but still giving error.
Sub myFill2()
Set sh = Sheets("Sheet1")
sh.Range("A1").AutoFill Destination:=sh.Range("A1:A" & sh.Range("B1")
- _
sh.Range("A1") + 1), Type:=xlFillSeries
End Sub
"Autofill method of range class failed."- Hide quoted text -

- Show quoted text -

Excelent it still says "Autofill method of range class failed."
 
D

Dana DeLouis

I have a start value in one cell and end value in another.
Start Value is 8788007677800201790
End Value is 8788007677800201799

How are you entering these "numbers" into Excel? Are these numbers entered
as Strings? The reason I ask is that Excel is limited to 15 digits.
However, there is a workaround. Do you want to have strings represent these
numbers instead?


vs
--
Dana DeLouis


Sinner said:
This works but numbers are changed to scientific notation.

Hi. Just a formatting fix. I guess with "Linear," we can remove the
xlDay
part.

Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Step:=1, _
Stop:=[B1], _
Trend:=False

With [A1].EntireColumn
.NumberFormat = "0"
.AutoFit
End With
End Sub

--
HTH :>)
Dana DeLouis




I have a start value in one cell and end value in another.
I want to generate a list between them.
Another option I like is "DataSeries."
A1 = Start Number
B1 = End Number
Sub Demo()
[A1].DataSeries _
Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Stop:=[B1], _
Trend:=False
End Sub
One advantage of DataSeries I believe is that the Algorithm is a
little
different. For example, if the step were other than 1 (say 0.1) you
will
have more "exact" values than if you drag down. There were a few old
Microsoft kb articles on this.
This should be simple.
I have a start value in one cell and end value in another.
I want to generate a list between them.
Start value: 8597000098881
End value: 8597000098890


Any idea?- Hide quoted text -
- Show quoted text -
Dear Dana,
This works but numbers are changed to scientific notation.- Hide quoted
text -

- Show quoted text -

Dear Dana,

Start Value is 8788007677800201790
End Value is 8788007677800201799

Not working for such length of figure.
 

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

Top