+ Reply to Thread
Results 1 to 8 of 8

Can You Extract Values From One Userform To Another Userform

  1. #1
    Registered User
    Join Date
    11-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Can You Extract Values From One Userform To Another Userform

    Hi,

    I've built a userform which is a complex ratings calculator for my work. There are many ("many") variables to the calculator which effect the output value it produces. Due to this I've had to create several textboxes which calculate different stages/aspects of the overall calculation (these are all hidden from the user) and then there is a final "total" textbox which adds up all these different textboxes (not hidden).

    My problem is that due to the complexities of the calculation and the amount of variables involved, I can't expect the user to just except the total output value, and I believe they would want to check some of the different stages of the calculation. I don't really want to just make a commandbutton which when selected makes certain textboxes visible again because there isn't a lot of room in the userform (I've sort of shoved these calculation texboxes underneath frames in the userform), but mainly fitting them all in would look extremely messy.

    Ideally I would want a commandbutton which when selected would open a new userform which can then extract the data from the hidden textboxes from the original userform.

    So first of all can this be done?

    If so, then for example purposes assume there userform1 and userform2 each with textbox1. and userform1 has a command button which when selected shows userform 2 (easy part) with a textbox1 value the same as the value in textbox1 from userform1.


    Many Thanks,

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Can You Extract Values From One Userform To Another Userform

    It can be done fairly easily but have you thought about just splitting your form into Multipages? ie with Tabs across the top
    If someone has helped you then please add to their Reputation

  3. #3
    Registered User
    Join Date
    11-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Can You Extract Values From One Userform To Another Userform

    I did think of that, and to be honest I could also easily just make the userform bigger, but I just really like the look of it now, and I also think the function of showing the calculations in a separate userform from the press of a button would look very cool.

  4. #4
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: Can You Extract Values From One Userform To Another Userform

    My experience of forms is more in Access however Im fairly certain the same principles should apply.

    In the 2nd form, have an On_Activate event which pulls the values from the 1st form something like.

    Me.Field1 = Form1.Field1

    There is also a 2nd method (In Access) which involves passing the data through the Open Form command in the form of OpenArgs which can be used by the Opening code.

  5. #5
    Registered User
    Join Date
    11-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Can You Extract Values From One Userform To Another Userform

    I'm probably doing something wrong, but that didn't work for me.

    I've attached an example userform.

    If someone could tell me the code to get the inputted value from textbox1 from userform1 to textbox1 from userform2.

    Thanks,
    Attached Files Attached Files

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,294

    Re: Can You Extract Values From One Userform To Another Userform

    You can refer to the controls directly:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  7. #7
    Registered User
    Join Date
    11-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Can You Extract Values From One Userform To Another Userform

    Thanks romperstomper , works perfectly.


    Appreciate the help.

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,294

    Re: Can You Extract Values From One Userform To Another Userform

    Glad to help.

+ 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] Userform: How do I use text/values from a spreadsheet to customize the userform?
    By bananajelly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2014, 03:47 PM
  2. [SOLVED] Changed userform combobox to listbox, unable to get userform to retrieve datasheet values
    By dragonabsurdum in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2013, 01:38 PM
  3. Replies: 4
    Last Post: 11-28-2012, 06:09 PM
  4. Change values of labels in a userform through another userform
    By Zhennie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-29-2009, 05:34 AM
  5. Userform to enter values and shown in same userform in list
    By helmekki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-19-2005, 11:23 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