+ Reply to Thread
Results 1 to 13 of 13

unable to activate textbox after macro runs twice

  1. #1
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    unable to activate textbox after macro runs twice

    Heya,
    Within attached file, I've got a combination of macros - A search routine, and a textbox generator which Leith was nice enough to send my way.

    Everything works all spiffy, except for one hiccup I don't understand, cause I'm a newb. I'd like the textbox to be activated after each macro, and I can't seem to get that to happen. Every second click of a checkbox causes my textbox to not only lose focus, but also not be visually displayed. This doesn't occur specifically when checking, or unchecking a box, it's just every second box clicked.

    File is attached in 2003 format with awesome dummy numbers and items.

    mew.
    Attached Files Attached Files
    Last edited by mewingkitty; 03-22-2009 at 08:03 PM.
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  2. #2
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    Coolest dummy info in the world, and not a soul to look at them.

    WOE IS ME!!!

    k not really, just wanted to give this a bump.

    bump!

    mew!

  3. #3
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    Ouch, not even a single comment after 23 views.

  4. #4
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    While I'm having a very nice discussion with myself, this is a little depressing :P

    Could I ask someone to quickly try this for me so that I know at the least if it's a code issue or an operating issue?

    Any feedback would be appreciated.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: unable to activate textbox after macro runs twice

    Hew, Mew,

    One reason it's probably slow is that there's three sheets, a bunch of code, and no explanation of how it's all supposed to work. That's more effort than people want to invest. How about explaining the absolute shortest path, and least amount of code executed, needed to see the problem?

    Also, I'd use Marlett checkboxes for this.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    K, will see what I can put together to make it as clear as possible.

    I have no idea what Marlett checkboxes are. :P

  7. #7
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    Otay,
    I should know better by now.
    Description of what the macros and code in the sheet do, are now listed in the sheet. CheckboxMacro is the one responsible for the procedure when they are clicked and unclicked. I would like the textbox to regain focus after any and all procedures, currently, I can not get that to work.
    Attached Files Attached Files

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: unable to activate textbox after macro runs twice

    I have no idea what Marlett checkboxes are
    A Marlett a is a check mark, and (like any other cell data) is in the same layer as the rest of the data, not on the drawing layer like a checkbox.
    Please Login or Register  to view this content.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: unable to activate textbox after macro runs twice

    In CheckBoxMacro, delete the line
    Please Login or Register  to view this content.
    But I'd start by putting Option Explicit at the top of every module, and declare variables appropriate to usage until the code compiles.

  10. #10
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    Ahh,
    Been messing around with that code you posted (at first was like WTF) and I think I'm starting to see how this works. This is much simpler. I'm assuming from your comment earlier about -
    not on the drawing layer like a checkbox.
    means that when interfacing with a checkbox, excel is operating in a different area than that where the textbox is located, therefore making it bang its head on a wall when trying to activate it. This also completely removes the need for a macro to place a dynamic number of checkboxes, since even if they're all active, checking a box with nothing beside it will effectively add nothing.

    I'm assuming this will also allow me to put focus back onto my textbox after any interaction with the marlett checkboxes? I'm of the mindset that if you're going through the trouble to make something, you might as well make it as well as possible. There's nothing else to do on this sheet other than type in the search box, and check or uncheck items, so I'm trying to avoid the need to click on the textbox when wishing to search again.

  11. #11
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: unable to activate textbox after macro runs twice

    Frustrating.
    Had that code working on a practice sheet, now I can't get it to do anything again.

    Edit:
    I can run it on a practice sheet with no problems, but can't get it to work at all on my sheet. There are no references to a specific workbook name or sheet in the code, so I'm a little at a loss there...

    Edit:
    I complain too much.
    Got it working. I'll see if I can't transfer my code for marking and unmarking the checkboxes over. I wrote it the first time, so you'd think I'd be able to make it work again
    If Leith happens to come across this, thank you for the code for placing those checkboxes, I'm going to hold onto it for future use, if nothing else, I still can't figure out how it works.

    For all purposes regarding the problem which I posted this thread regarding, this is now solved.

    mew!
    Last edited by mewingkitty; 03-22-2009 at 08:03 PM.

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: unable to activate textbox after macro runs twice

    My fault, Mew:
    Please Login or Register  to view this content.
    Controlling EnableEvents is essential, sorry.

    Then put this is a code module:
    Please Login or Register  to view this content.
    Last edited by shg; 03-22-2009 at 08:09 PM.

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: unable to activate textbox after macro runs twice

    Sorted, Mew? That's great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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