+ Reply to Thread
Results 1 to 4 of 4

Pass a simple value from custom UserForm to VBA module

  1. #1
    Registered User
    Join Date
    02-21-2012
    Location
    Media, PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Pass a simple value from custom UserForm to VBA module

    I have a VBA script that has a few different ways of running, and I want to have a way of selecting the method when the macro is first run. Right now, I have a few vbYesNo boxes with some really weird wording. My thought is to create a custom UserForm with few different command buttons with the options on it. All I have to do is return a different value for each button and and I have the tree set up later in the code to run. I know generally how to create userforms, but I haven't been able to implement one yet.

    Thanks in advance, I've already used existing threads on this forum a few times to help me out (I'm new to VBA) but I'm still having problems here.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: Pass a simple value from custom UserForm to VBA module

    Could you perhaps post what you have so far and what you want to achieve - from what you have posted if you press command button 1 then you want to return a value to a module to be be used in some way - if you could perhaps post your workbook and post the section of code where you are having problems. Make sure there is no sensitive data in the workbook and be very specific about what you would like to achieve. Perhaps give a specific scenario you would like to achieve and once you learn how to return a value by pressing a button in the context of your workbook you should be able to extrapolate this to the other buttons you intend to implement. Without a sample workbook and an idea of the workflow your want it is hard to answer your question satisfactorily.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    02-21-2012
    Location
    Media, PA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Pass a simple value from custom UserForm to VBA module

    Please Login or Register  to view this content.
    That's a watered down version of what my code does. It basically takes data from one format and converts it to another. There are a few more nested vbYesNo's to get all of the options. I'd like to be able to use one UserForm to replace all of them. It works right now, but that's because I wrote it and I'm using it. I plan on giving it to the other guys in my department, and I'd rather it be self-explanitory than have them delve through multiple queries.

    I was thinking something along the lines of:

    Please Login or Register  to view this content.

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

    Re: Pass a simple value from custom UserForm to VBA module

    Is this what you are after ?
    Attached Files Attached Files



+ 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