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: 14
Default Macro that names a sheet

I am working a a macro that creates a chart and then names itself. The name
could change depending on which stat the code is being ran from. I have it
working as a single macro but I do not want to repeat all of the code so I
can save on size. I have a button on my output page that selects a range of
data on my Raw Data sheet, then it starts running the macro to create the
graph. I want to get the graph code to name the sheet "Manager_AHT_Graph" or
Manager_IR_Graph" or any of the other stats that I am trending data for.
Here is where I am with the code that works fine.
Sub Create_AHT_Graph()
Range(Selection, Selection.End(xlDown)).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:= _
"Manager_AHT_Graph"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub

Now what I want it to do is take the AHT part of the name and use
cell.offset to move to the "header" row (not actually a header since it is at
line 252) and use that name. If I am picturing it right in my head, when I
push the button to run the IR graph then it should select the range and begin
creating the chart then when it goes to name it the code should be something
like (because this pukes on itself) this:
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:= _
"Manager_" & cell.Offset(1, 0) & "_Graph"

Any ideas how I can get this to work? Or a better way of not repeating that
code for every button that I need to create a graph?

Thank you,

 
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
list sheet names vertically below the active cell - need macro. Eddy Stan Excel Worksheet Functions 2 September 28th 07 07:48 PM
Need a macro to include file names in a folder to excel sheet anil Excel Discussion (Misc queries) 0 March 12th 07 09:10 AM
Using Sheet names & Workbook names in VBA coding Colin Foster[_5_] Excel Programming 5 July 7th 06 07:04 PM
Sheet names in a macro bern Excel Programming 4 April 16th 06 04:22 PM
return all worksheet tab names and chart sheet tab names in report - an example DataFreakFromUtah Excel Programming 2 October 6th 04 08:09 PM


All times are GMT +1. The time now is 11:06 PM.

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"