+ Reply to Thread
Results 1 to 16 of 16

Combine two codes to vbYesNo, "Notification

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Combine two codes to vbYesNo, "Notification

    Can I combine two codes into one too shorten process? Both codes are run from commandbutton,if I can get first code into second code I could get rid of a button in process. So
    commandbutton 12 code would run if vbYesNo is yes and if no it would use misc folder like now.
    Thanks for any help or suggestions.

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Last edited by zplugger; 03-23-2015 at 02:48 PM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Hello again,

    I THINK you can call one sub from within the other sub using Call. And, I THINK it would go in your IF or Then part of your statement. There is probably more to it then just that, but again, I only know enough to mess code up really bad.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    Would it be better to call the other macro or add to code?

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Better? I do not know. It might be easier to call the other macro because (I THINK) if you add the code, one or both of the codes would have to be modified more.

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    This is hard, ran into problems making Dir. with existing code.

  6. #6
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Did you try adding the code, or calling it?

  7. #7
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    Tried making it, my first code only add folder if dir is there.This is going to be harder then expected.Both button's run the code perfect, going to take time to add together.

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    I am still learning too, so I am not very good at troubleshooting yet.
    If you decide to try to call it, after Else, instead of exit sub, put
    Please Login or Register  to view this content.
    This might not even be the proper way to call a Sub, but this is the way I would do it.

  9. #9
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    I'm not sure if this is going to be possible, lot going on with the codes. If I say yes to call commandbutton12 then it should create dir,but if I say no then it should give me option to save to misc.? Simple
    vba I can make work but this is more complex.

  10. #10
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    Got this to work, not sure if its the cleanest and best way.

    Please Login or Register  to view this content.

  11. #11
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Glad you were able to get it to work. As for the "best" or "cleanest" way......We may have to rely on LJMetzger and/or berlan to answer that.

  12. #12
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    Trying to add, changed vbyesno to vbyesnocancel
    If MSG = vbCancel Then
    Exit Sub

    not sure where to put in code?

  13. #13
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Try to put it in the line before IF MSG = vbYes then

  14. #14
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    still brings up save box?

  15. #15
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Combine two codes to vbYesNo, "Notification

    Got it finally lol
    Please Login or Register  to view this content.

  16. #16
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Combine two codes to vbYesNo, "Notification

    Nice. glad you got it, I wasn't sure of placement.

+ 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] vbYesNo, "Notification
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-22-2015, 09:17 AM
  2. When a cell is becomes "True", need the user to get a Msgbox notification.
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-22-2011, 12:16 PM
  3. "read only" notification on un protected sheet
    By mfs in forum Excel General
    Replies: 1
    Last Post: 12-29-2010, 06:07 AM
  4. VbYesNo MsgBox won't respond to "No"
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2005, 12:10 PM
  5. VBYesNo MsgBox - Computer always says "Yes"
    By Peter Rooney in forum Excel General
    Replies: 4
    Last Post: 12-22-2005, 10:45 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