+ Reply to Thread
Results 1 to 4 of 4

Trying to select only one chart rather than all charts on spreadsheet - Help VBA coding

  1. #1
    Registered User
    Join Date
    10-31-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    2

    Trying to select only one chart rather than all charts on spreadsheet - Help VBA coding

    Sub MarginChart()
    Dim Cht As ChartObject
    For Each Cht In ActiveSheet.ChartObjects
    Cht.Chart.ChartArea.AutoScaleFont = False
    Cht.Height = Application.CentimetersToPoints(3.57)
    Cht.Width = Application.CentimetersToPoints(5.81)
    ActiveChart.Axes(xlValue).TickLabels.Font.Size = 7
    ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 7
    ActiveChart.ChartArea.Border.LineStyle = xlNone

    Next Cht

    End Sub

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Trying to select only one chart rather than all charts on spreadsheet - Help VBA codi

    Hi and welcome to the forum.

    1) Please read our http://www.excelforum.com/forum-rule...rum-rules.html and observe them. Now edit your post using code tags.

    2) In presented code, VBA loops through all chartobjects. If you want to use just one - use it's number or name or somehow select just one.

    for instance try:
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    10-31-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    2

    Re: Trying to select only one chart rather than all charts on spreadsheet - Help VBA codi

    Thanks for your help Kaper. Im new to VBA and just trying to find would be very useful, would love to crack this.

    I entered your code but get an error with Cht.Axes (xlValue).TickLabels.Font. Size = 7 this is highlighted in yellow

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Trying to select only one chart rather than all charts on spreadsheet - Help VBA codi

    Please do what I suggested in p.1 above (editing+code tags).
    Then note that problematic line comes from your code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Coding for Automatic Re-sizing of charts when values are equal to zero
    By bobby.bobby in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2013, 12:05 AM
  2. [SOLVED] Excel 2007 : If Then Else and/or Select Case Coding Assistance
    By MrSir in forum Excel General
    Replies: 3
    Last Post: 07-05-2012, 12:48 PM
  3. Coding to Create similar charts for Range of coloumns
    By montego in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2010, 01:05 PM
  4. [SOLVED] Help with coding of charts
    By Michael Raphael in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-21-2006, 12:15 AM
  5. [SOLVED] Color coding column charts
    By Don Rouse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2005, 12:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1