+ Reply to Thread
Results 1 to 3 of 3

Trigger macro when ActiveX scroll bar control changes

Hybrid View

simonc2 Trigger macro when ActiveX... 01-25-2019, 11:19 AM
romperstomper Re: Trigger macro when... 01-25-2019, 11:40 AM
simonc2 Re: Trigger macro when... 01-25-2019, 11:42 AM
  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    23

    Trigger macro when ActiveX scroll bar control changes

    The scroll bar is linked to a cell, so my first tries to get it to trigger the macro have been using

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim KeyCells As Range
    
        ' The variable KeyCells contains the cells that will
        ' cause an alert when they are changed.
        Set KeyCells = Range("a2")
        
        If Not Application.Intersect(KeyCells, Range(Target.Address)) _
               Is Nothing Then
    
            ' Display a message when the designated cell has been
            ' changed.
            ' Place your code here.
            MsgBox "Cell " & Target.Address & " has changed."
           
        End If
    End Sub
    to check for a change in the linked cell. But this doesn't seem to trigger the macro. (The code above works perfectly in a simple worksheet with no ActiveX control, where I simply type a value into the target cell and press enter.)

    Can anyone suggest a way to detect a change in the ActiveX control which I can use to trigger the macro?

    Thanks for advice

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Trigger macro when ActiveX scroll bar control changes

    An ActiveX scrollbar has several events, including its own Change event that you might use.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Trigger macro when ActiveX scroll bar control changes

    That's brilliant. Thanks very much. I now have the trigger working.

+ 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] Assign Macro to ActiveX Control
    By Troy73 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2017, 10:09 PM
  2. multiple activeX control combo boxes trigger each other
    By aprildu in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-04-2016, 01:01 AM
  3. Macro for a form control button to reset scroll bars to a static column of numbers
    By urbphoto in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2014, 04:13 PM
  4. Macro code to change the ActiveX Control Object Properties
    By jackgan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2013, 02:31 PM
  5. Assigning Macros to Macro created ActiveX Control Box
    By sm9748 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-18-2013, 02:02 PM
  6. Scroll bar (Form Control) - Resetting the scroll bar to particular values
    By Vishb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2011, 04:10 AM
  7. Replies: 2
    Last Post: 01-19-2006, 09:25 AM

Tags for this Thread

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