Results 1 to 6 of 6

Change Chart data range

Threaded View

  1. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,085

    Re: Change Chart data range

    Here a possibility
    Chart1 is prepared with column "B" and each time the macro is used (Control + r) next column is selected.
    If it is OK next macro will select previous column
    Public WkCol As String
    
    Sub Auto_open()
        WkCol = "B"
        UpdateChart1 (WkCol)
    End Sub
     
     
    Sub ChangeChart1()
        WkCol = Split(Cells(1, Cells(1, WkCol).Column + 1).Address, "$")(1)
        UpdateChart1 (WkCol)
    
    End Sub
    
     
    
    Sub UpdateChart1(NwCol As String)
    Const Fom = "SERIES(Sheet1!$#$1,Sheet1!$A$2:$A$µ,Sheet1!$#$2:$#$µ,1)"
    Dim LR As Long
        LR = Cells(Rows.Count, 1).End(3).Row
        
        T = Replace(Fom, "µ", LR)
        T = Replace(T, "#", NwCol)
        ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1).Formula = "=" & T
        ActiveSheet.Cells(1, WkCol).Select
    End Sub
    Attached Files Attached Files
    Last edited by PCI; 03-30-2020 at 01:22 PM.
    - Battle without fear gives no glory - Just try

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Want to change chart data range from Kg to stones
    By johnnypat in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 05-18-2019, 02:21 AM
  2. Copy chart and change data range
    By excelactuary in forum Excel Charting & Pivots
    Replies: 9
    Last Post: 07-24-2018, 12:13 PM
  3. [SOLVED] Expand Defined Name Range Horizontally to Dynamically Change Chart with new data
    By machl22 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-20-2017, 12:14 PM
  4. Change the data range for an existing chart
    By Eebigdog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2016, 01:13 PM
  5. [SOLVED] Change chart source data range
    By jprlimey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2015, 10:51 AM
  6. [SOLVED] Change Chart Data Range to show YTD data
    By Harribone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2015, 04:12 PM
  7. chart change on my range
    By pedjvak in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-04-2015, 02:45 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