Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Help!!! Trying to make a plot
I am trying to write a macro to create a plot in Excel. However the range of
the plot is different and it cant be hardcoded. Can anyone help with this. The code i am using now is below, but it is given me error 1004. Where the "**" are is where the error occurs Private Sub VRH1H4Chartss() 'Option Explicit Dim LastCellVRH1H4x As Long Dim LastCellVRH1H4y As Long On Error Resume Next Application.DisplayAlerts = False Charts("VRH1H4").Delete On Error GoTo 0 With Sheets("SerialTable") LastCellVRH1H4x = .Cells(.Rows.Count, "F").End(xlUp).Row LastCellVRH1H4y = .Cells(.Rows.Count, "K").End(xlUp).Row End With Application.ScreenUpdating = False Charts.Add ActiveChart.Name = "VRH1H4" With ActiveChart .SeriesCollection.NewSeries .SeriesCollection(1).XValues _ = Worksheets("SerialTable").Range("f2:F" & LastCellVRH1H4x) _ .Address(external:=True) .SeriesCollection(1).Values _ = Worksheets("SerialTable").Range("k2:K" & LastCellVRH1H4y).Value .HasTitle = True .ChartType = xlXYScatterSmooth .HasLegend = False .ApplyDataLabels Type:=xlDataLabelsShowValue .Axes(xlCategory).TickLabels.Orientation = xlHorizontal .ChartTitle.Font.Bold = True .ChartTitle.Font.Size = 12 '.PlotArea.Top = 18 '.PlotArea.Height = 162 '.Axes(xlValue).MaximumScale = 0.6 '.Deselect End With Application.ScreenUpdating = True Sheets("Program").Activate End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
xy scatter chart-How can you make the axis equal for a 1H:1V plot | Charts and Charting in Excel | |||
excel should make it easier to have a 1 to 1 plot area in chart | Charts and Charting in Excel | |||
Contour plot | Charts and Charting in Excel | |||
make hidden window or workbook visible without specify the name | Excel Worksheet Functions | |||
make cell contents equal to null value - not blank, but empty | Excel Worksheet Functions |