Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PMF PMF is offline
external usenet poster
 
Posts: 2
Default Fill series macro with different steps

HI

I want to fill a sereis based on the first and last numbers in the
selection, with the step set to linear interoplate between the first
and last numbers. Does anyone suggest some VBA code that would help?

This is the same as selecting two numbers with blanks in between and
then doing Edit:fill:Series. Excel automatically works out the correct
step. However, if I record a macro for this, the step doesn't is fixed
to the step value I recorded it with. So it doesn't help if I want to
do this many many times....

Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Fill series macro with different steps

Sub LinearFill()
Selection.DataSeries Type:=xlLinear, Trend:=True
End Sub

Does that do what you want?

Troy


"PMF" wrote in message
om...
HI

I want to fill a sereis based on the first and last numbers in the
selection, with the step set to linear interoplate between the first
and last numbers. Does anyone suggest some VBA code that would help?

This is the same as selecting two numbers with blanks in between and
then doing Edit:fill:Series. Excel automatically works out the correct
step. However, if I record a macro for this, the step doesn't is fixed
to the step value I recorded it with. So it doesn't help if I want to
do this many many times....

Cheers



  #3   Report Post  
Posted to microsoft.public.excel.programming
PMF PMF is offline
external usenet poster
 
Posts: 2
Default Fill series macro with different steps

Troy

Thanks, that's so much better than what I eventually came up with:

Sub linear_fill()
bot = UBound(Selection.Value, 1)
num = bot - 1

a = Selection(1, 1).Value
b = Selection(bot, 1).Value
For i = 2 To bot - 1
m = (b - a) / num
Selection(i, 1).Value = a + m * (i - 1)
Next i

End Sub
!!!
Cheers
Piers

"TroyW" wrote in message ...
Sub LinearFill()
Selection.DataSeries Type:=xlLinear, Trend:=True
End Sub

Does that do what you want?

Troy


"PMF" wrote in message
om...
HI

I want to fill a sereis based on the first and last numbers in the
selection, with the step set to linear interoplate between the first
and last numbers. Does anyone suggest some VBA code that would help?

This is the same as selecting two numbers with blanks in between and
then doing Edit:fill:Series. Excel automatically works out the correct
step. However, if I record a macro for this, the step doesn't is fixed
to the step value I recorded it with. So it doesn't help if I want to
do this many many times....

Cheers

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
Fill Series Dates: not letting me change the series from year to m Mike Excel Discussion (Misc queries) 1 January 24th 08 05:08 PM
how can we hide the steps of macro running azam Excel Discussion (Misc queries) 3 January 9th 07 01:09 PM
HOW TO USE FILL SERIES Wilsonzoo New Users to Excel 2 March 23rd 06 01:10 AM
Edit Fill Series - How do I fill using minute increments IUnknown Excel Discussion (Misc queries) 1 January 29th 06 12:50 PM
Complex Macro to perform an operation as it steps down cells? Jeni Q Excel Worksheet Functions 0 August 25th 05 04:38 PM


All times are GMT +1. The time now is 10:55 PM.

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

About Us

"It's about Microsoft Excel"