View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Naming a worksheet as a variable in a Active Chart Series


For Each sh In Activeworkbbok.Worksheets
ActiveChart.SeriesCollection(1).XValues = "='" & sh.Name &
"'!R2C4:R14C4"
Next sh

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"Farooq Sheri" wrote in message
...
I have about 100 sheets each named in terms of a node in a telecom

network.
For each node I have to graph a series of values and also find a max

within a
range. I want to use a variable naming convention for worsheets in my VB
code. For example in the following line of code instead of the sheet name

I
would like to use a variable such as str:
dim str as string
Sheets("CCA01(7011)").Activate
str = ActiveSheet.Name
ActiveChart.SeriesCollection(1).XValues = "='CCA01(7011)'!R2C4:R14C4".

Instead writing this line for each sheet I want to use a loop to each

sheet
and for each sheet I want to execute the above code. Let us say my sheets

are
named MSC01, MSC02, MSC03,...

Thanks in advance