+ Reply to Thread
Results 1 to 18 of 18

Dropbox choice runs macro Error ??

  1. #1
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Exclamation Dropbox choice runs macro Error ??

    Hi there. I want to make a dropbox choice run an independant macro for this choice. I've looked on forums , everywhere And i just can't get it to work. When i run the macro from the Sheet code, it works. But the minute i try it , it pops the error : Sub or fonction not defined..


    My macros are placed on a module but the one for the dropbox is on sheet1. Heres my code:

    Please Login or Register  to view this content.

    - The first line is highlighted when the error pops.
    Can someone explain to me what i'm doing wrong?? Thanks!
    Last edited by Eliann; 05-30-2011 at 07:07 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Dropbox choice runs macro Error ??

    Hi Eliann and welcome to the forum,

    It would be easier for us to read you code if you Edit your message and then click on "Go Advanced". Highlight your code and click on the "#" above the Advanced Message area to put Code Tags around it.

    After doing the above. Your code has two End Sub lines and no End Case. I wonder if that hurts. Do you have Option Explicit at the top of each module to help discover problems before you try to run them? Also, I've seen a "As Range" but never a "As Excel.Range". I wonder if that is causing propblems.

    Here is some good info on Event Code http://www.cpearson.com/excel/Events.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    its edited
    Actually i don't know much about excel and macros , i,m trying to learn . I took the code off another forum .. Maybe its not the right code??

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Dropbox choice runs macro Error ??

    Hi,

    I was thinking you would want a
    Please Login or Register  to view this content.
    type of construct.
    Read it at http://www.ozgrid.com/VBA/vba-intersect.htm

    To accomplish what I think you want, you may need some VBA code.

  5. #5
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    hmm i dont think this is it :S maybe i could send you the file?

    i really want each choice to have its own macro open when selected.

    Those macro are done and working , its just copying text from another sheet and pasting it at a certain place in the first sheet.

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Dropbox choice runs macro Error ??

    You can attach a workbook by
    Clicking on "Go Advanced" and then on the Paper Clip Icon above the advanced message area.

  7. #7
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    Heres my file Thanks a lot for your help by the way! i was about to cry in from of my computer XD ^^
    Attached Files Attached Files

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Dropbox choice runs macro Error ??

    Hi,

    See the attached. I hung the code on a Selection Change instead of Worksheet Change as it would loop continuously. I believe the quotes in the CASE statements were messing things up. I've removed them. I also believe you can't use parenteses in the CASE statement as it looks like a parameter in a function call. I think there were problems with English vs your language character set for me.

    Try the Easy Words in E1 to see if they work. Set a breakpoint in your code and step through it one line at a time to see what is happening. http://www.cpearson.com/excel/Debug.htm

    Some of the words in the attach will work and some won't. See the VBA Code to see what words I've changed and perhaps select better dropdown selections without parins or single quote marks so the Case statements will work.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    Seems like its working better than before but the'res no choice anymore, I can Click on "humain" but i cant select, and When i click on E1 The First macro" draconien" shows up o.0

    Sorry for the language i'm french :P

  10. #10
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Dropbox choice runs macro Error ??

    Please find.
    Your denominations were pretty inconsistent in terms of spelling.
    Attached Files Attached Files
    Regards,

    Gabor

    Protect trees.. maybe one day we need to climb back....

  11. #11
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    Aw thats neat!.. But its so different from what i was doing that i just don't get it. I cant manage to get it to work and i need to understand it because i need to reproduce the same type of macro.

  12. #12
    Forum Contributor Gabor's Avatar
    Join Date
    02-15-2004
    Location
    Székesfehérvár, Hungary
    MS-Off Ver
    xl2016
    Posts
    226

    Re: Dropbox choice runs macro Error ??

    I'm afraid I do no fully understand what you mean.
    Is it working at your computer, or you cannot make it work?

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Dropbox choice runs macro Error ??

    First: do not use merged cells.

    You won't need all those macro's.
    If you structure the data in sheet4 systematically you only need 1 line of code.
    This will suffice:
    Please Login or Register  to view this content.
    Last edited by snb; 05-31-2011 at 04:56 AM.



  14. #14
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    I really like what you suggest, seems pretty easy! but still i dont understand what you mean by systematically. I really need to understand it because i need to reproduce it many times. If this one macro could save me from making lots of other ones, i'm going for it hehe

  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Dropbox choice runs macro Error ??

    Based on the example you posted this may be simpler:

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    Okay! Nice , I think i was trying too hard , now my list on sheet 4 is clean, separated, and it works! I was able to get it to paste in cells a:15 to G:16(from sheet1) the only probleme is to get from A3 to E4 on sheet 4 , it copies the first column only . I see where it goes but when i try to change it the syntax never works! I can see the end of it and the understanding of this code, If i can just get this right ill be able to reproduce it and finish my project!
    Attached Files Attached Files
    Last edited by Eliann; 06-02-2011 at 04:21 AM.

  17. #17
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Dropbox choice runs macro Error ??

    You could consider to use the help in the VBEditor and read what's written about currentregion.
    It means that in sheet4 you have to fill column B, C and D to get the full currentregion; space will suffice.
    The 'currentregion' is the most flexible approach.
    An alternative could be:

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    05-30-2011
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Dropbox choice runs macro Error ??

    OH I got it!! Thanks for explaining!! It works perfectly now ! Thanks all 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)

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