[Excel 2007] Store a cell name for later use-VBForums
Results 1 to 2 of 2

Thread: [Excel 2007] Store a cell name for later use

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    262

    [Excel 2007] Store a cell name for later use

    The below code below all works except I can't get the range to be a real range, it inserts the actual words xminRange xmaxRage etc into the range fields for the chart

    Here is what I am trying


    Code:
    Dim xminRange As String
    Dim xmaxRange As String
    Dim yminRange As String
    Dim ymaxRange As String
    
    xminRange = "Milestones!V$10"
    xmaxRange = "Milestones!V$22"
    yminRange = "Milestones!S$10"
    ymaxRange = "Milestones!S$22"
    
        ActiveChart.PlotArea.Select
        ActiveChart.SeriesCollection(1).XValues = "xminRange:xmaxRange"
        ActiveChart.SeriesCollection(1).Values = "yminRange:ymaxRange"

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    36,812

    Re: [Excel 2007] Store a cell name for later use

    It's because you are passing a string containing that the names of the variables, rather than using the variables to build a string. It should be like this:
    Code:
        ActiveChart.SeriesCollection(1).XValues = xminRange & ":" & xmaxRange

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.