+ Reply to Thread
Results 1 to 11 of 11

Button Issues - moving, resizing and worse

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Button Issues - moving, resizing and worse

    Hey all - this is making me crazy and I cannot find any solutions. Hoping it something relatively straight forward.

    I have an Excel 2016 workbook that has 7 active x buttons on one sheet. I have the properties set so they should not move or size with the columns. When the workbook first opens, they are neat and orderly and do what they should do. Then after I run any of the macros that they initiate, the become unusable.
    -- If I click button A, while the mouse is depressed it partially overlays Button B and doesn't execute the macro.
    -- If I click button B, while the mouse is depressed it appears 6 inches to the right of where the button is on the sheet (I'll try to attach a small MP4)

    When I save and reopen the file, the buttons seem to have redrawn - they overlap, the font is different and they don't work consistently (Perhaps related to pixel location of where I'm clicking)

    Anybody have any ideas what makes this happen, and how I can put a stop to it? It's making development extremely time consuming!
    Attached Images Attached Images
    Last edited by JP Romano; 05-06-2019 at 08:34 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Button Issues - moving, resizing and worse

    I've had this before ... I couldn't work out what was causing it so I added a little "repositioning proc" to reset their size & position in the sheet. I think I called it from the Sheet Change event and after each run. I've also read somewhere that setting Take Focus On Click property to True can cause this. It may not what you're looking for and perhaps others know of a solution rather than just removing the symptoms ...
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Button Issues - moving, resizing and worse

    I tend to notice this happening if the file is opened on a computer with a different screen resolution set up than the one the file was created on, or if the screen resolution is changed in some way like attaching it to a projector or similar.

    Not ideal, but one way around it is adding a little code to the start of your existing code. Something like:
    Please Login or Register  to view this content.
    Hope that helps in some way...

    BSB

  4. #4
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Button Issues - moving, resizing and worse

    MatrixMan / BadlySpelledBuoy - thank you both for the suggestions. I'm actually going to use both of them to see if it helps!

  5. #5
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Button Issues - moving, resizing and worse

    If you are using ActiveX buttons put them on a UserForm - problem solved.
    torachan.

  6. #6
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Button Issues - moving, resizing and worse

    torachan - thanks... I had them on a form to begin with but the users prefer them on the worksheet - my next step, if the above solutions don't remedy the situation, will be to return to a form, OR create a custom ribbon with the functionality accessible via various buttons there.

  7. #7
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Button Issues - moving, resizing and worse

    Or use form controls in the sheet instead of ActiveX controls.

  8. #8
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Button Issues - moving, resizing and worse

    Try the attached approach and see if this solves the problem.
    The code is in the worksheet module.
    As soon as you click on any cell in the visible window of sheet 1 the buttons will locate themselves.
    Also in the code all the attributes can be reset.
    Hope this is of some use to ActiveX fans.
    torachan.
    Attached Files Attached Files

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Button Issues - moving, resizing and worse

    Quote Originally Posted by torachan View Post
    Hope this is of some use to ActiveX fans.
    As clever as this approach is for making things buttons stay put, I am an ActiveX fan and I often develop Excel based tools with complex landing pages that contain large numbers of buttons.

    You can guarantee I'd write the code to position them all nicely then the end users would want another button added right in the middle of all the others which would of course mean I'd have to rewrite lots of code.

    That's why I go for the approach I mentioned in post #3. It's never failed to keep the buttons in place and appropriately sized when switching resolution, computers or even when switching OS on the same computer. Those very simple lines of code do the job effectively and without firing a lengthy sub every time I select a different cell. And when I am asked to add a new button I can just drag/drop design, add the new button and away I go without tinkering around with code for previously place controls.

    Just my tuppence worth.

    BSB

  10. #10
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Button Issues - moving, resizing and worse

    @JP Romano.
    Despite developing spreadsheets and applications since the advent of VisiCalc & Lotus123 I am still learning
    On re-reading your post
    If I click button A, while the mouse is depressed it partially overlays Button B and doesn't execute the macro
    I now have to presume it is .xlsm file, documentation exists that in the past that ActiveX (on sheet rather than on UserForms) and macros are bad companions.
    Could this possibly be a hidden source of the problem.
    torachan.

  11. #11
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Button Issues - moving, resizing and worse

    Or just use shapes...

    (or forms controls as mentioned above)

    Problem solved, no code reuqired

+ 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] Macro Buttons Resizing and Moving Randomly
    By georgedixon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-04-2017, 10:15 AM
  2. [SOLVED] Resizing and Moving a chart
    By sokeefe14 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2015, 10:11 AM
  3. Active x buttons keep moving and resizing
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-03-2015, 06:14 PM
  4. active x buttons randomly resizing and moving
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-15-2015, 03:03 PM
  5. Images moving and resizing when printing
    By 0jt7 in forum Excel General
    Replies: 1
    Last Post: 04-11-2008, 11:29 AM
  6. resizing and moving chart elements
    By Tim in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-15-2006, 08:10 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