Graph refuses to lower its tickmarks

wasabi

New Member
Joined
Apr 12, 2010
Messages
28
I've got a macro that creates a graph based on information on the first three columns of the spreadsheet. It works just fine, but now I'm stuck on a tiny, futile detail that refuses to budge.

The code's a bit long, but bear with me.
Code:
Sub Graph()
Application.ScreenUpdating = False
With ActiveWorkbook.Worksheets(2)
    ActiveWorkbook.Worksheets(2).Activate
    Range("B2").End(xlDown).Activate
    Set Rng = Range("B2", ActiveCell)
    Set LstCl = ActiveCell
    Sname = Range("A1").Parent.Name
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Rng, PlotBy:=xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:=Sname
    ActiveChart.HasTitle = False
    With ActiveChart
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "STEP"
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "SIGY"
        .Axes(xlValue).ReversePlotOrder = True
        '.Axes(xlCategory).Select
        'With Selection.Border
        '    .Weight = xlHairline
        '    .LineStyle = xlAutomatic
        'End With
        'With Selection
        '    .MajorTickMark = xlOutside
        '    .MinorTickMark = xlNone
        '    .TickLabelPosition = xlHigh
        'End With
        .HasLegend = False
        .HasDataTable = False
        .PlotArea.Select
        For i = 2 To LstCl.Row
            .SeriesCollection.NewSeries
            .SeriesCollection(i).Select
            With Selection
                .ChartType = xlXYScatter
                .XValues = "='" & Sname & "'!R" & i & "C1"
                .Values = "='" & Sname & "'!R" & i & "C2"
                .Name = "='" & Sname & "'!R" & i & "C3"
                With .Border
                    .Weight = xlHairline
                    .LineStyle = xlNone
                End With
                .MarkerBackgroundColorIndex = xlAutomatic
                .MarkerForegroundColorIndex = xlAutomatic
                .MarkerStyle = xlNone
                .Smooth = False
                .MarkerSize = 5
                .Shadow = False
                .ApplyDataLabels AutoText:=True, LegendKey:= _
                False, ShowSeriesName:=True, ShowCategoryName:=False, ShowValue:=False, _
                ShowPercentage:=False, ShowBubbleSize:=False
                With .DataLabels
                    .HorizontalAlignment = xlCenter
                    .VerticalAlignment = xlCenter
                    .ReadingOrder = xlContext
                    .Position = xlLabelPositionAbove
                    .Orientation = xlHorizontal
                    .Font.Size = 8
                End With
            End With
        Next i
        .SeriesCollection(1).ChartType = xlLineMarkers
    End With
    Set ChOb = ActiveChart.Parent
    ChOb.Height = Range(.Cells(1, 4), .Cells(LstCl.Row, 3 + Application.WorksheetFunction.Round(LstCl.Row / 2, 0))).Height
    ChOb.Width = Range(.Cells(1, 4), .Cells(LstCl.Row, 3 + Application.WorksheetFunction.Round(LstCl.Row / 2, 0))).Width
    ChOb.Top = Range(.Cells(1, 4), .Cells(LstCl.Row, 3 + Application.WorksheetFunction.Round(LstCl.Row / 2, 0))).Top
    ChOb.Left = Range(.Cells(1, 4), .Cells(LstCl.Row, 3 + Application.WorksheetFunction.Round(LstCl.Row / 2, 0))).Left
End With
Worksheets(1).Activate
Application.ScreenUpdating = True
End Sub

Everything works except for the part I commented out. I can remove the comments and the code will still run just fine, it just ignores that batch of code, for whatever reason. Also, the only part of that block that really matters is the .TickLabelPosition = xlHigh part, but I tried to see if the rest was necessary to make it work. It wasn't.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,054
Messages
6,169,834
Members
452,284
Latest member
TKM623

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top