Results 1 to 3 of 3

Thread: [Excel 2003] .Location of a chart

Hybrid View

  1. #1
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [Excel 2003] .Location of a chart

    31 is correct

    Can I see the exact code that you are trying to use?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  2. #2

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: [Excel 2003] .Location of a chart

    Code:
            Set cht = objExcel.Charts.Add
            With cht
                
                .ChartType = IIf(blnLines, 65, 51) 'xlLineMarkers,xlColumnClustered
                .SetSourceData Source:=sht.Range(sht.cells(lngStartRow, 1), sht.cells(lngRowOP, lngMaxCol + 1)), PlotBy:=1 'xlRows
                If .SeriesCollection.Count > 1 Then
                    .SeriesCollection(1).Delete
                End If 'since the days are numbers it considers it data hence adds a line - the code above removes that series...
                Set rng = sht.Range(sht.cells(lngStartRow, 2), sht.cells(lngStartRow, lngMaxCol + 1))
                For lngLoop = 1 To cht.SeriesCollection.Count
                    .SeriesCollection(lngLoop).XValues = "='" & sht.Name & "'!" & rng.Address(referencestyle:=-4150)  'xlr1c1
                Next
                
                .HasTitle = True
                .ChartTitle.Characters.Text = strBrand & " - Daily " & strTitle & " (from " & IIf(blnUseLastUpdated, "last updated", "created") & ")"
                .Axes(xlCategory, xlPrimary).HasTitle = True
                .Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
                .Axes(xlValue, xlPrimary).HasTitle = True
                .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Number of " & strYAxis
            
                .HasLegend = True
                .Legend.Position = IIf(blnLegendBottom, -4107, xlRight) 'xlbottom
                .HasDataTable = False
            
            
        '---- last thing - change the chart to an object!
                .Location WHERE:=2, Name:=sht.Name 'xlLocationAsObject
            End With
    Something like that above
    Name of the sheet shouldn't matter, just that it was 31 chars...

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width