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: 2
Default ActiveSheet in a Macro?

I've created a macro to display a variable-length chart
based on dynamic chart example from tushar-mehta.com. It
works fine.

My question is, is there any way to make the worksheet
name based on the currently active worksheet instead of a
fixed worksheet name?

Here's my example:

Sub h()
'
' h Macro
' Macro recorded 1/31/2005 by Randy Spaulding
'
ActiveWorkbook.Names.Add Name:="YValues",
RefersToR1C1:= _
"=OFFSET(TemplateQT!R2C21,0,0,COUNTA(TemplateQ T!
C21),1)"
ActiveWorkbook.Names.Add Name:="XValues",
RefersToR1C1:= _
"=OFFSET(TemplateQT!R2C1,0,0,COUNTA(TemplateQT !
C21),1)"
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues
= "=TemplateQT.xls!XValues"
ActiveChart.SeriesCollection(1).Values
= "=TemplateQT.xls!YValues"
ActiveChart.Location Whe=xlLocationAsObject,
Name:="TemplateQT"
ActiveChart.HasLegend = False
End Sub


Instead of "TemplateQT" being hardcoded as the worksheet
name, can I replace all instances of "TemplateQT" with
the current active worksheet?
 
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
Get ActiveSheet name in VB Geoff Lambert[_2_] Excel Programming 1 October 8th 04 02:25 PM
name of the activesheet rasta Excel Programming 1 October 3rd 03 09:49 PM
ActiveSheet.Name? Andrew Stedman Excel Programming 5 July 30th 03 01:17 PM
ActiveSheet Graham[_3_] Excel Programming 0 July 30th 03 09:08 AM
ActiveSheet Graham[_3_] Excel Programming 0 July 29th 03 04:47 PM


All times are GMT +1. The time now is 10:08 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"