+ Reply to Thread
Results 1 to 6 of 6

Creating graphs on multiple worksheets

  1. #1
    Registered User
    Join Date
    01-26-2007
    Posts
    3

    Question Creating graphs on multiple worksheets

    Dear members,

    I would like to know how to create graphs on multiple worksheets, without selecting data over and over again, creating graph, select graph style etc. etc.
    Data are aranged exactly the same for all worksheets. How to create macro code that would automatize this?

    Thanks a lot!

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Herfst
    Dear members,

    I would like to know how to create graphs on multiple worksheets, without selecting data over and over again, creating graph, select graph style etc. etc.
    Data are aranged exactly the same for all worksheets. How to create macro code that would automatize this?

    Thanks a lot!
    Hi,

    The easy way, as with all such things, is to record a macro whilst setting up the first chart, then assign a Sortcut Key and then check the code for specific sheetnames and use 'ActiveSheet' in their place, then run on each sheet required.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    01-26-2007
    Posts
    3

    Question Re: creating graphs on multiple worksheets

    Dear Bryan,

    I think I got the point.
    This is how the code lookes like:

    Sub autochart()
    '
    ' autochart Macro
    ' creating graph
    '
    ' Keyboard Shortcut: Option+Cmd+g
    '
    ActiveCell.Range("A1:B5").Select
    Charts.Add
    ActiveChart.ChartType = xlXYScatterSmooth
    ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B5")
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
    End Sub

    But I have to admit that I am not that familiar with VBA code. Simply replacing one or all "Sheet1" statements by "ActiveSheet" generates some kind of error. How would the actual format looks like in that case?

    Thanks,

    Lucas

  4. #4
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Herfst
    Dear Bryan,

    I think I got the point.
    This is how the code lookes like:

    Sub autochart()
    '
    ' autochart Macro
    ' creating graph
    '
    ' Keyboard Shortcut: Option+Cmd+g
    '
    ActiveCell.Range("A1:B5").Select
    Charts.Add
    ActiveChart.ChartType = xlXYScatterSmooth
    ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:B5")
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
    End Sub

    But I have to admit that I am not that familiar with VBA code. Simply replacing one or all "Sheet1" statements by "ActiveSheet" generates some kind of error. How would the actual format looks like in that case?

    Thanks,

    Lucas
    try as
    Please Login or Register  to view this content.
    hth
    ---

  5. #5
    Registered User
    Join Date
    01-26-2007
    Posts
    3

    Smile Re: creating graphs on multiple worksheets

    OK Bryan,

    Now it works! Thanks a lot,

    Lucas

  6. #6
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by Herfst
    OK Bryan,

    Now it works! Thanks a lot,

    Lucas
    good to see, and thanks for the response.
    ---

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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