LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Repetative Tasks and Variables

I want to tidy up and reduce the amount of code if possible by handling
repetative actions such as adding Series to a chart.

Currently I am using something like this below to add a second Series to the
ActiveChart but also use almost identical code for Series 3, 4, 5 etc up to a
dozen or so. I sthere any way I can reference different Variables within
this code e.g. for Pri_Chart_Source_Sheet_2, Pri_Chart_Source_Sheet_3 ,
Pri_Chart_Source_Sheet_4 etc

With ActiveChart
If Pri_Series_Data_Column_2 < Empty Then
Set PlotValuesSeries =
Sheets(Pri_Chart_Source_Sheet_2).Range(Pri_Series_ Data_Column_2 & "2:" &
Pri_Series_Data_Column_2 & Last_Row_of_Pri_Source_Sheet_2)
Set PlotXValuesSeries =
Sheets(Pri_Chart_Source_Sheet_2).Range(Pri_Timesta mp_Data_Column_2 & "2:" &
Pri_Timestamp_Data_Column_2 & Last_Row_of_Pri_Source_Sheet_2)
Series_Index_No = Series_Index_No + 1
.SeriesCollection.Add
Sheets(Pri_Chart_Source_Sheet_2).Range(Pri_Series_ Data_Column_2 & ":" &
Pri_Series_Data_Column_2)
.SeriesCollection(Series_Index_No).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
.ColorIndex = 5
End With
With Selection
.MarkerStyle = xlNone
End With
With Worksheets(Pri_Chart_Source_Sheet_2)
ActiveChart.SeriesCollection(Series_Index_No).XVal ues =
PlotXValuesSeries
ActiveChart.SeriesCollection(Series_Index_No).Valu es =
PlotValuesSeries
End With
End If
End With

 
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 can I reduce repetative code leerem Excel Discussion (Misc queries) 4 August 3rd 08 12:20 PM
Formula needed for repetative spreadsheet amatur wkr Excel Worksheet Functions 3 April 30th 08 08:47 PM
Repetative text smack Excel Worksheet Functions 4 May 27th 07 12:27 AM
Repetative Row Deletes scratching my head Excel Discussion (Misc queries) 1 May 30th 05 09:38 PM
Repetative conditional formatting Danielle Excel Programming 2 February 16th 05 12:48 AM


All times are GMT +1. The time now is 03:51 AM.

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"