+ Reply to Thread
Results 1 to 9 of 9

With a move label macro, prevent label from moving onto another label

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    WA, USA
    MS-Off Ver
    2007
    Posts
    69

    With a move label macro, prevent label from moving onto another label

    The code below is designed to move a selected label down every time the macro is called. Is there any way to prevent the label from moving down if another label is already in the position? In other words, I don't want a label to be able to move onto another label (making it hard to see both).


    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: With a move label macro, prevent label from moving onto another label

    Hi Socrates,

    Something like this perhaps?

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    09-04-2014
    Location
    WA, USA
    MS-Off Ver
    2007
    Posts
    69

    Re: With a move label macro, prevent label from moving onto another label

    Hi xladept. I appreciate your attempt. You are the only brave soul so far. It didn't work when I tested it. I got this error "Object required". The bold section below was highlighted in debugging.

    Quote Originally Posted by xladept View Post
    Hi Socrates,

    Something like this perhaps?

    Please Login or Register  to view this content.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: With a move label macro, prevent label from moving onto another label

    Hey Socrates,

    Thanks for the rep!


    I've got a typo (my wife is a secretary(!))


    Please Login or Register  to view this content.

    *That Hemlock doesn't taste too bad????
    Last edited by xladept; 11-30-2014 at 06:13 PM. Reason: > to <

  5. #5
    Registered User
    Join Date
    09-04-2014
    Location
    WA, USA
    MS-Off Ver
    2007
    Posts
    69

    Re: With a move label macro, prevent label from moving onto another label

    Hi xladept,

    I modified your code a little to make it work for my purposes. I know that my modification was not made to perfection, but I was having trouble having the code both exit sub and unselect the label. If you could instruct me on how to accomplish this I will add back in the exit sub.

    Thanks!

    Please Login or Register  to view this content.
    Yes, Socrates decided that death was not as scary as we surmise: I disagree with him, of course, on that subject.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: With a move label macro, prevent label from moving onto another label

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-04-2014
    Location
    WA, USA
    MS-Off Ver
    2007
    Posts
    69

    Re: With a move label macro, prevent label from moving onto another label

    It is a very convoluted (and surely amateur) code, but here is my complete code relevant to this thread. It can support infinite labels that have a size of the following: 60 height and 60 width.

    This code moves a 'selected' label using keyboard commands. The code now prevents a label from moving over the top of another label.

    Please Login or Register  to view this content.
    Thank you xladept for the help!
    Last edited by SocratesJC; 12-01-2014 at 02:57 AM.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: With a move label macro, prevent label from moving onto another label

    You're welcome - glad you got it working!

  9. #9
    Registered User
    Join Date
    09-04-2014
    Location
    WA, USA
    MS-Off Ver
    2007
    Posts
    69

    Re: With a move label macro, prevent label from moving onto another label

    Can somebody take a crack at speeding this code up?
    Please Login or Register  to view this content.
    did wonders, but the code is still slow and the screen refresh still occurs after the code finishes (slowing the code with each added label).

    Thanks in advanced!

+ 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. Replies: 6
    Last Post: 01-07-2014, 03:24 PM
  2. Replies: 1
    Last Post: 09-30-2013, 09:52 AM
  3. Filter Pivot Table Row Label by Another Row Label
    By bdcelli in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-14-2013, 12:57 PM
  4. Transpose/Iterate Group Label to a Row Label
    By Rumble in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-27-2011, 04:35 PM
  5. COPY LABEL FORM FROM EXCEL TO A LABEL
    By xrayAndi in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-05-2006, 10:25 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