Consulting

Results 1 to 2 of 2

Thread: Graph in VBA

  1. #1

    Graph in VBA

    Hi guys,

    I'm relatively new to VBA and this is way beyond me. So my macro has outputted the interpolated values. The values in green are the values that match the inputs.

    Q1) I made this graph in excel, not VBA. Is there a way to create this graph in VBA? I've made OK graphs, but nothing to this extent. The red line is from the output array and the blue dots are from the input array.

    Q2) If I can make that graph, I would like to know how to make it dynamic. Meaning I know I would want to graph to populate Cells(F2:G#) - I will know this number by the time I want to plot the graph but how do I tell VBA that? I've tried this: Cell(F2:G&"OutputLength") but I got an error...

    Thanks!
    Attached Images Attached Images

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    You could create a graph from scratch everytime your data changed, but you might prefer the easier route of merely adjusting the plotted ranges; record yourself adjusting the source ranges of the series (click the series on the chart and adjust the extent of the highlighted ranges on the sheet with the mouse).
    Then post that code here and we should be able to tweak.
    If you were to include your macro which calculates the interpolated points, we could glean the extent of the information from that and incorporate the chart changes into it.

    (There is another way to do it without vba by using dynamic named ranges, however, since you're using vba already, there's little point.)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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