+ Reply to Thread
Results 1 to 6 of 6

VBA for scrollbar

  1. #1
    Registered User
    Join Date
    12-09-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    12

    VBA for scrollbar

    Hi,

    I´m trying to change colour of shapes based on value from the ScrollBar.

    I came up with this code which works but only for values that are not connected to ScrollBar (More precisely It works after reclicking to the cell but not right away after value from scrollbar changes).

    Can anybody knows how to solve this please?


    Private Sub Worksheet_Change(ByVal Target As Range)

    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
    If IsNumeric(Target.Value) Then
    If Target.Value < 100 Then
    ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = vbRed
    ElseIf Target.Value >= 100 And Target.Value < 200 Then
    ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = vbYellow
    Else
    ActiveSheet.Shapes("Oval 1").Fill.ForeColor.RGB = vbGreen
    End If
    End If
    End Sub


    Thanks for any response!!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: VBA for scrollbar

    A scrollbar is probably considered a formula, worksheet change events are not affected by formulas.

  3. #3
    Registered User
    Join Date
    12-09-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    12

    Re: VBA for scrollbar

    Thank you for your response!

    Do you have any idea/different approach how to solve it pls?

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: VBA for scrollbar

    Scrollbar_Change?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-09-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    12

    Re: VBA for scrollbar

    Sorry, but it does not have any effect on it

  6. #6
    Registered User
    Join Date
    12-09-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    12

    Re: VBA for scrollbar

    Sorry, my stupid mistake, that works just fine. Thanks a lot for your help!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Scrollbar Name
    By cabroncito29 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-25-2016, 01:42 PM
  2. Scrollbar help!
    By xia0lis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2013, 12:05 PM
  3. Change ScrollBar Max value when a second ScrollBar vale is changed?
    By Jon Henry in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2013, 06:47 PM
  4. Scrollbar
    By Scottmk in forum Excel General
    Replies: 1
    Last Post: 03-15-2007, 09:53 PM
  5. [SOLVED] When a scrollbar is not a scrollbar
    By Flash in the Pan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2006, 10:40 PM
  6. Scrollbar
    By dstiefe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2005, 04:05 PM
  7. scrollbar reslut makes another scrollbar to show
    By Patrik in forum Excel General
    Replies: 0
    Last Post: 04-18-2005, 11:06 AM

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