Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Default Generate series according to range and increment

I am working with a two page workbook. On page one I have upper and lower values of a range (example 0.0 to 5.0, or 0 to 100) and an increment value (example 0.2 or 5). On page two I would like a column to automatically fill with the series of values within the range according to the increment value.

For example: If the range on page one is from 0.0 to 5.0, and the increment is 0.2, I would like a column in page two to fill 0.0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.2… …4.8, 5.0 in a column from top to bottom.

I hope this is clear enough; I am not very versed in Excel vocabulary. Any help is appreciated. Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Generate series according to range and increment

Hi,

Am Thu, 16 May 2013 18:21:31 +0100 schrieb primeride2k:

I am working with a two page workbook. On page one I have upper and
lower values of a range (example 0.0 to 5.0, or 0 to 100) and an
increment value (example 0.2 or 5). On page two I would like a column to
automatically fill with the series of values within the range according
to the increment value.


Start value in Sheet1 A1, stopp value in A2, increment in B1:

Sub FillLinear()
With Sheets("Sheet2")
.Range("A1") = Sheets("Sheet1").Range("A1")
.Range("A1").DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=Sheets("Sheet1").Range("B1"), _
Stop:=Sheets("Sheet1").Range("A2")
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Thu, 16 May 2013 18:21:31 +0100 schrieb primeride2k:

I am working with a two page workbook. On page one I have upper and
lower values of a range (example 0.0 to 5.0, or 0 to 100) and an
increment value (example 0.2 or 5). On page two I would like a column to
automatically fill with the series of values within the range according
to the increment value.


Start value in Sheet1 A1, stopp value in A2, increment in B1:

Sub FillLinear()
With Sheets("Sheet2")
.Range("A1") = Sheets("Sheet1").Range("A1")
.Range("A1").DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=Sheets("Sheet1").Range("B1"), _
Stop:=Sheets("Sheet1").Range("A2")
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
This works great when I choose to run the macro from the drop down menu. How would I set it up so I can use it as a template? I would like to open the excel file, input the range and increments, then have it generate the series on sheet 2 automatically. Also, if I change the range and/or increment on sheet 1, I would like the series to change accordingly on sheet 2 automatically.

Thanks for your help!
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Generate series according to range and increment

Hi,

Am Thu, 16 May 2013 20:32:15 +0100 schrieb primeride2k:

How would I set it up so I can use it as a template? I would like to
open the excel file, input the range and increments, then have it
generate the series on sheet 2 automatically. Also, if I change the
range and/or increment on sheet 1, I would like the series to change
accordingly on sheet 2 automatically.


right-click on tab of sheet1 = Show code = paste following code in the
code window:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A2,B1")) Is _
Nothing Then Exit Sub

With Sheets("Sheet2")
.Columns("A").ClearContents
.Range("A1") = Sheets("Sheet1").Range("A1")
.Range("A1").DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=Sheets("Sheet1").Range("B1"), _
Stop:=Sheets("Sheet1").Range("A2")
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #5   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Thu, 16 May 2013 20:32:15 +0100 schrieb primeride2k:

How would I set it up so I can use it as a template? I would like to
open the excel file, input the range and increments, then have it
generate the series on sheet 2 automatically. Also, if I change the
range and/or increment on sheet 1, I would like the series to change
accordingly on sheet 2 automatically.


right-click on tab of sheet1 = Show code = paste following code in the
code window:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A2,B1")) Is _
Nothing Then Exit Sub

With Sheets("Sheet2")
.Columns("A").ClearContents
.Range("A1") = Sheets("Sheet1").Range("A1")
.Range("A1").DataSeries Rowcol:=xlColumns, Type:=xlLinear, _
Step:=Sheets("Sheet1").Range("B1"), _
Stop:=Sheets("Sheet1").Range("A2")
End With
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
I am working on Excel for Mac 2011 version 14.1.0 and it does not give me an option for show code when I right click the sheet tab. Is there another place I can enter it? Thanks!


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Generate series according to range and increment

Hi,

Am Tue, 21 May 2013 17:29:45 +0100 schrieb primeride2k:

I am working on Excel for Mac 2011 version 14.1.0 and it does not give
me an option for show code when I right click the sheet tab. Is there
another place I can enter it? Thanks!


try Alt+F11


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I Generate Multiple Graphs for Different Series of Data MC_FRx_99 Charts and Charting in Excel 2 September 16th 09 09:19 PM
how to generate series of random numbers which are all unique jyoti Excel Programming 1 April 17th 08 11:07 AM
Generate auto increment number from VB form john_t_h[_20_] Excel Programming 3 September 6th 05 11:19 PM
How do I increment a fill series by a number other than 1? Say I. John Excel Worksheet Functions 3 January 6th 05 09:34 PM
how can i get formulaes to increment by one in a series of worksh. mt Excel Discussion (Misc queries) 1 December 29th 04 05:44 PM


All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"