Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 5 of 5

Thread: add scrollbar to chart using vba problem

  1. #1
    Join Date
    24th September 2011
    Posts
    3

    add scrollbar to chart using vba problem

    I am adding a scrollbar to a chart using vba. I'v been successful getting the scrollbar added; however when I view the chart, the scrollbar has the "sizing handles" around it, and the "bar" (object that moves back and forth) is missing until I resize the scrollbar manually. I've tried changing the initial size of the scrollbar to no avail. I've also set the visible property to True and the enabled property to True, also to no avail. Does anyone have a clue as to what I need to do? I'd like for the scrollbar to be fully functional after the vba code has run.
    Thanks in advance for any help!

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    23rd September 2011
    Posts
    73

    Re: add scrollbar to chart using vba problem

    Hello Johncblacker,

    Could you please post the vba code that you are using to add a scrollbar to your charts to further aid in answering your question.

    Thanks,
    Paul

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    24th September 2011
    Posts
    3

    Re: add scrollbar to chart using vba problem

    OK, here's my code...I hope I'm following the rules correctly for including code...if not, please correct my error!
    [code]

    ActiveSheet.ScrollBars.Add(624763.5, 4271616, 5095730.25, 189166.5).Select
    With Selection
    .Value = 60
    .Min = SMin
    .Max = SMax
    .SmallChange = 1
    .LargeChange = 1
    .LinkedCell = "Spikes!$O$5"
    .Left = 0#
    .Width = 680.32
    .Top = 0#
    .Height = 15
    .Visible = True
    .Enabled = True
    .Display3DShading = True
    End With
    ActiveChart.Shapes("Scroll Bar 1").Select
    Selection.OnAction = "ScrollBarChange"

    [end code]

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    23rd September 2011
    Posts
    73

    Re: add scrollbar to chart using vba problem

    Hi John,

    You need to edit your post and change [end code] to [/code]

    It appears that you're adding your scroll way down in the bottom right of the sheet and then trying to move it back up to the top left, is that correct?
    VB:
    .left = 0# 
    .Top = 0# 
    
    
    I think the following code should do what you are looking for
    VB:
    Sheet1.ScrollBars.Add(624763.5, 4271616, 5095730.25, 189166.5).Select 
     
    With Selection 
        .Value = 60 
        .Min = SMin 
        .Max = SMax 
        .SmallChange = 1 
        .LargeChange = 1 
        .LinkedCell = "Sheet1!$O$5" 
        .Display3DShading = True 
         
        With .ShapeRange 
            .Left = 0 
            .Width = 680.32 
            .Top = 0 
            .Height = 15 
        End With 
         
        .OnAction = "ScrollBarChange" 
    End With 
    
    
    Assuming that SMax and SMin are valid integers. If you get an error, first thing I would do is change SMin to 0 and SMax to 100 and see if this helps. Then go from there.

    Any problems, let me know

    Thanks,
    Paul

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    24th September 2011
    Posts
    3

    Re: add scrollbar to chart using vba problem

    Looks like a winner thanks...btw, how do i go back and edit a previous post to change the [end code] to [/code] ?

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Pivot chart scale problem
    By nxp in forum EXCEL HELP
    Replies: 4
    Last Post: November 7th, 2010, 05:09
  2. Chart scale problem
    By laythss in forum EXCEL HELP
    Replies: 2
    Last Post: April 2nd, 2005, 12:29
  3. Replies: 7
    Last Post: August 6th, 2004, 05:13
  4. chart problem
    By Fluppe in forum EXCEL HELP
    Replies: 23
    Last Post: May 20th, 2003, 22:46
  5. Chart Caption problem
    By natalievance in forum EXCEL HELP
    Replies: 13
    Last Post: April 15th, 2003, 03:41

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
  •  
porno