Results 1 to 4 of 4

HOW to Place chart at specific cell location with MACRO VBA

Threaded View

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Jordan
    MS-Off Ver
    2010
    Posts
    2

    Exclamation HOW to Place chart at specific cell location with MACRO VBA

    How to place a chart at a specific cell location within a worksheet. I am adding a chart using pivot table within the same sheet
    and need to place the chart under the data.

    The code I am using to add the chart is as follows, and it's working fine but I need to know if there is away to set the location by column# and row# eg. position (r1,c2) to set the chart under my pivot table in dynamic way



    Sub sbPivotChart_SameSheet()
    Dim pt As PivotTable, ptr As Range, Cht As Chart
    If ActiveSheet.PivotTables.Count = 0 Then Exit Sub
    Set pt = ActiveSheet.PivotTables(2)
    Set ptr = pt.TableRange1
    Set Cht = ActiveSheet.Shapes.AddChart.Chart

    With cht.ChartArea
    'adjust position and size (both in points) of the Chart Area:
    .Width = 440
    .Height = 300
    .Left = 100
    .Top = 100
    End With
    With Cht
    .SetSourceData ptr
    .ChartType = xlLine
    End With
    End Sub
    Last edited by asmaasab; 06-10-2015 at 10:02 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 07-11-2013, 02:08 AM
  2. Replies: 1
    Last Post: 06-30-2013, 05:58 PM
  3. insert a photo (any file type), resize it, and place it in a specific location.
    By jaganath in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2010, 08:44 AM
  4. Macro for PDF to specific location and file name from Cell
    By NokiaFanatic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-13-2010, 12:00 AM
  5. Place chart at specific cell location
    By Landmine in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2006, 12:40 AM

Tags for this Thread

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