LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Create a Graph with a Macro

Hello I have the following code:

Sub Gráfica_Curva_S()
Range("A4").Select
Range(Selection, Selection.End(xlToRight)).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkersStacked
ActiveChart.SetSourceData Source:=Sheets("Curva-S").Range("A4:P4"), PlotBy _
:=xlRows
ActiveChart.SeriesCollection(1).Name = "=""Curva-S"""
ActiveChart.Location Whe=xlLocationAsNewSheet, Name:="Gráfica Curva-S"
With ActiveChart.Axes(xlCategory)
..HasMajorGridlines = True
..HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
..HasMajorGridlines = True
..HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
End Sub


I have 3 questions, help on any is greatly appreciated:

1) On the 6th line of the code, how do I manage to make the range more
dynamic? Instead of having ("A4:P4") to have from A4 until the last column
containing data? (By the way, it is maybe usefull to mention that Row 1
contains the number of that (week) so from A:P I have on Row 1 from 1:15, so
maybe I can have a MAX formula and the code takes that result to specify the
columns for the range or something)

2) On line 10, I specified the name for the Sheet that will be created when
I run the Macro. But when I already have that sheet created and I run the
macro it gives a Run-time Error because that sheet already exists and it
creates a sheet called Sheet # but what is after line 10 of the code is not
created. How do I manage, again, to make a more flexible name, maybe Curva-S
& "current date" (dd-mm-yy) or something like that?

3) I would like to also automatically generate Value Data Labels, aligned
above, rotated 90°, size 6 and Arial font.

Thanks a lot!
 
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
Using a macro to create a macro in another workbook Gizmo63 Excel Worksheet Functions 2 May 15th 06 09:48 AM
How do I create a macro that will compare columns and place data CompuCat Excel Worksheet Functions 0 March 20th 06 06:21 PM
Vb macro stops when I try to create more than 89 charts Tiberius Charts and Charting in Excel 0 January 19th 06 05:52 PM
how to create automatic macro with if statement or similar betatryck_se Excel Discussion (Misc queries) 2 December 14th 05 11:32 AM
How do I create an excel macro to append to a cell with existing i zola_tiara Excel Discussion (Misc queries) 4 September 14th 05 08:22 PM


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