View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Sinner Sinner is offline
external usenet poster
 
Posts: 142
Default Generate list of numbers between start and end value

On Sep 18, 8:12 am, excelent
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

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

It says,

"Autofill method of range class failed."