#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Series Code

I have 2 columns of information, F & G. First, I want to Sort th
worksheet by Column G, then I wanted to re-order column G, startin
with the first row as "1" and filling down G with a series with a ste
of 1 (or 1, 2, 3, etc down G for all the rows until the last row wher
there is info in the corresponding F column).

When I record a Macro it gives me this code, but goes to a set G21
because in this particular case the last info in F was F21, bu
obviously this wouldn't always be the case. Thanks for all your help.

Bo


Rows("5:5").Select
Range("G5").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("G5"), Order1:=xlAscending
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
_
DataOption1:=xlSortNormal
Range("G5").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlUp)).Select
Range("G5:G21").Select
Range("G21").Activate
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear
Date:=xlDay, _
Step:=1, Trend:=Fals

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Series Code

Bo

try this:

Sub TestSeries()
With Range(Range("G5"), Range("G5").End(xlDown))
.Sort Key1:=Range("G5"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
.DataSeries Rowcol:=xlColumns, _
Type:=xlLinear, _
Date:=xlDay, _
Step:=1, _
Trend:=False
End With
End Sub

Regards

Trevor


"rickey24 " wrote in message
...
I have 2 columns of information, F & G. First, I want to Sort the
worksheet by Column G, then I wanted to re-order column G, starting
with the first row as "1" and filling down G with a series with a step
of 1 (or 1, 2, 3, etc down G for all the rows until the last row where
there is info in the corresponding F column).

When I record a Macro it gives me this code, but goes to a set G21,
because in this particular case the last info in F was F21, but
obviously this wouldn't always be the case. Thanks for all your help.

Bo


Rows("5:5").Select
Range("G5").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("G5"), Order1:=xlAscending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal
Range("G5").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlUp)).Select
Range("G5:G21").Select
Range("G21").Activate
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear,
Date:=xlDay, _
Step:=1, Trend:=False


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Series Code

lcol = ActiveSheet.UsedRange.Column
ActiveSheet.UsedRange.Columns.Count
lrow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count
Range(Cells(1, 1), Cells(lrow, lcol)).Sort Key1:=Range("G1"), _
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
For x = 1 To lrow
Cells(x, 7).Value = x
Next x

Try that out. - Piku

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Series Code

Works great, thanks, I appreciate it.

B

--
Message posted from http://www.ExcelForum.com

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
Macro code to put series name next to individual line in line grap Otani Charts and Charting in Excel 3 February 23rd 10 07:24 PM
color code series by an independent column of data rockdoc69 Charts and Charting in Excel 1 September 12th 08 10:54 AM
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
Jon Peltier's code: can't delete initial series?? Ed Charts and Charting in Excel 2 October 4th 06 03:11 AM
series graph -- one series being added to another series rich zielinski via OfficeKB.com Charts and Charting in Excel 3 March 30th 05 06:23 PM


All times are GMT +1. The time now is 09:41 PM.

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"