Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Naming a worksheet as a variable in a Active Chart Series

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Farooq Sheri - 24 Jan 2006 10:42 GMT
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
Ken Johnson - 24 Jan 2006 11:50 GMT
Hi Farooq,
this is only a stab in the dark, and I'm assuming you  have less than
100 sheets.
K = K + 1
ActiveChart.SeriesCollection(1).XValues = "='MSC" & IIF(K>9,"0","") &
"'!R2C4:R14C4"
inside your loop.
Ken Johnson
Ken Johnson - 24 Jan 2006 11:52 GMT
Hi Farooq,
this is only a stab in the dark, and I'm assuming you  have less than
100 sheets.
K = K + 1
ActiveChart.SeriesCollection(1).XValues = "='MSC" & IIF(K>9,"0","") &
"'!R2C4:R14C4"
inside your loop.
Ken Johnson
Farooq Sheri - 24 Jan 2006 12:11 GMT
Thanks for the reply. First of my apologies for misleading you by naming my
sheets as MSC01, MSC02, MSC03,.. The names are all necessary starting with
MSC, it could be STP01, MOIP1 etc.

If I refer to sheets using index number then for each sheet I can find its
name using ActiveSheet.Name and then use this string in the formula. The
question is how to use a string within the formula. Also how can I find the
total number of sheets in workbook?

Thanks again

> Hi Farooq,
> this is only a stab in the dark, and I'm assuming you  have less than
[quoted text clipped - 4 lines]
> inside your loop.
> Ken Johnson
Bob Phillips - 24 Jan 2006 12:00 GMT
   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)

> 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
[quoted text clipped - 11 lines]
>
> Thanks in advance
Farooq Sheri - 26 Jan 2006 08:00 GMT
Thanks Bob and Ken for your help.

Farooq

>     For Each sh In Activeworkbbok.Worksheets
>         ActiveChart.SeriesCollection(1).XValues = "='" & sh.Name &
[quoted text clipped - 29 lines]
> >
> > Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.