+ Reply to Thread
Results 1 to 24 of 24

Copy Text in 1 userform textbox to a different userform textbox

  1. #1
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Copy Text in 1 userform textbox to a different userform textbox

    Im just curious if anyone knows how to do this....Im trying to copy the number in Userform3 textbox 1 to Userform1 textbox 3.

    So far Im using this, but its not doing anything ...

    Please Login or Register  to view this content.
    But that doesnt seem to work. any ideas how I could change that?

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Copy Text in 1 userform textbox to a different userform textbox

    depends of what you want to do...anyway, it's funny!
    so, if you have a value in textbox1-userform1, using yr code, it shows in textbox1-userform2
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    hey John

    Thanks for the reply...I should have explained my bad...

    Userform3 textbox1 is simply just a prompt that asks a user 'quantity'. Once the user enters the number it copys over to Userform 1, textbox3.

    Does that make sense?

    Quote Originally Posted by john55 View Post
    depends of what you want to do...anyway, it's funny!
    so, if you have a value in textbox1-userform1, using yr code, it shows in textbox1-userform2

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Copy Text in 1 userform textbox to a different userform textbox

    assuming this is not a joke...lol
    try
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    haha, nope, no joke, thats why Im asking. But whats above didnt seem to work, let me show you my code here:

    Userform 1:
    Please Login or Register  to view this content.
    Userform3:
    Please Login or Register  to view this content.
    Quote Originally Posted by john55 View Post
    assuming this is not a joke...lol
    try
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Copy Text in 1 userform textbox to a different userform textbox

    perhaps
    UserForm1
    Please Login or Register  to view this content.
    UserForm2
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey John,

    Thanks again! So userform3 is triggered by a selection of a textbox. If a user selects 'Yes' userform 3 pops up. Which (its not a big thing to get userform 3 to appear)....

    Moving the number from textbox1 in Userform3 to textbox3 in userform 1 appears to be the delimma. I used what was above, still had no luck. Would you like to see an example workbook perhaps?

    Ill briefly explain what Im doing and who knows maybe their is a simplier way of doing what I need.....

    So the user of this 'userform' selects from a drop down what kind of fruit they want, lets say they select 'apples'. The next part of the form asks the user, would you like to purchase multiple apples?
    ...If the user checks the, 'Yes', checkbox, a prompt comes up asking - "How many would you like to buy", the user enters the quantity they want to buy, and once they enter the quantity and hit submit the number gets moved over to userform 1, textbox 3.

    Originally, I had a space on userform 1 for the user to enter the quantity, but the people requesting this application requested there be a prompt that appears and asks the quantity. Hopefully that makes sense.

    Thanks again!

    Quote Originally Posted by john55 View Post
    perhaps
    UserForm1
    Please Login or Register  to view this content.
    UserForm2
    Please Login or Register  to view this content.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Text in 1 userform textbox to a different userform textbox

    If this is just for a single value couldn't you use an InputBox?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  9. #9
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey Norie,

    Worked like a dream! Thanks pal!

    I thought the only way to do this way to use a copy method from another userform. Thanks a bunch!


    Quote Originally Posted by Norie View Post
    If this is just for a single value couldn't you use an InputBox?
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hi,
    perhaps in yr file it doesn't work, I know nothing about yr file, I just created a test file, used the above code-in accordance with yr request-and it copied the value of textbox1(UserForm1) to...it doesn't matter now!
    the more information you give, the more solution(s) you get!

  11. #11
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey,

    I decided to post this question here since its pretty much related to the above question. I have a combobox as well with the third option being, <Enter a New Project Name> - and an inputbox appears. What I would like the user to be able to do is enter a project name, then that project name gets added to the combobox for future use. Right now - I have it so that the use can enter the project name, and it appears in the combobox while the userform is open, but say the user closes the userform, then re-opens it - the newly entered project name disappears. Is there a way I can add it to the combobox permanently....This is the code Im using to trigger the the inputbox:

    Please Login or Register  to view this content.
    And this is the code that populates the combobox when then userform initializes

    Please Login or Register  to view this content.








    Quote Originally Posted by Norie View Post
    If this is just for a single value couldn't you use an InputBox?
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey John,

    I definitely see what your saying. I bet it does work, I probably just have something stupid in my code somewhere thats preventing it from working. but thanks for the help and suggestions. I know for the future at least how to copy the values incase I ever need to!

    thanks a bunch

    Quote Originally Posted by john55 View Post
    Hi,
    perhaps in yr file it doesn't work, I know nothing about yr file, I just created a test file, used the above code-in accordance with yr request-and it copied the value of textbox1(UserForm1) to...it doesn't matter now!
    the more information you give, the more solution(s) you get!

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Text in 1 userform textbox to a different userform textbox

    If you want to add new projects you'll need to store a list of projects somewhere.

    You would then change the code to populate the combobox from that list.

    When a new project is added you would add it to the stored list and repopulate the combobox.

  14. #14
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    You know, I was thinking it had to be done that way to. Is there no way to do it without having to store a list on an excel sheet somewhere?
    I suppose I can do it that way and just hide the sheet the list is being stored in. It would be more beneficial for company purposes if it could just be added to the list as I mentinoed above, but if there's no way to do that with vba then Im not going to waste time on it!

    thanks pal



    Quote Originally Posted by Norie View Post
    If you want to add new projects you'll need to store a list of projects somewhere.

    You would then change the code to populate the combobox from that list.

    When a new project is added you would add it to the stored list and repopulate the combobox.

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Wouldn't it be more beneficial to have a list of objects stored somewhere?

    It could be used in other places not just the userform.

  16. #16
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    The only place itll ever need to be used is the Userform Im thinking. Because after these fields are filled out the primary purpose of inputting this data is to make a chart. But lets say I do use a list (list all the names in cells) - then as the 'Row Source' in the properties for the combobox I use the list name...That brings me to my next question (still related to the input box) - so as the very last selection in the list I put <Enter New Project> and again - if the user selects that option an input box prompts the user to enter the new project name... How do I always ensure that the input box will keep adding the new project names to the list in the excel sheet so that the combo box will always be populated with the new project names?

    Quote Originally Posted by Norie View Post
    Wouldn't it be more beneficial to have a list of objects stored somewhere?

    It could be used in other places not just the userform.

  17. #17
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Text in 1 userform textbox to a different userform textbox

    You've kind of lost me I'm afraid.

    What do you see as an alternative to storing, somewhere, the list of projects?

    If you wanted to alter the code so the 'list' was hard -coded then things are going to get pretty complicated.

  18. #18
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey,

    Thanks for the reply. What do you mean a list of objects do you mean declared somewhere in the VBA code, or do you mean literally a list of items in cells (Ie: A1 - Name of Project 1, A2 - Name of Project 2, A3 - Name of Project 3)?

    Really my goal here is to allow the user to add project names to a combo box if the project name does not currently exist in the combo-box.

    Quote Originally Posted by Norie View Post
    Wouldn't it be more beneficial to have a list of objects stored somewhere?

    It could be used in other places not just the userform.

  19. #19
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Assuming your in the userform that has the value that you selected when you click the ok button couldn't you simply do

    Please Login or Register  to view this content.
    ??

    Both userforms would need to be open I believe for it to work.
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  20. #20
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy Text in 1 userform textbox to a different userform textbox

    List of objects?

  21. #21
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: Copy Text in 1 userform textbox to a different userform textbox

    as an option you can use a combobox for your items, to see them/to add item/to remove item
    this is what I use
    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Hey,

    Sorry for the late reply, I didnt see the message. I re-read what I put up there it was kind of confusing. So from my understanding you suggested instead of me populating the combo box this way:

    With Me.ComboBox1
    .Add Item "Project 1"
    .Add Item "Project 2"
    End With

    That I list the projects in rows in an Excel sheet, so for example in worksheet 1
    A1 Would have > "Enter New Project"
    A2 Would have > "Name of Project 1"
    A3 Would have > "Name of Project 2"
    A4 Would have > "Name of Project 3"

    So I decided to take your suggestion and make a list in an excel sheet and populate the combo box that way. So now Im populating the combo-box by going in the 'Properties' window for the combo box and under > 'Row Source' speecifying a list name (I call the list name projects).

    Now this is where my question comes in....Say a user selects 'Enter New Project' from the combo-box...I can get a prompt to come up asking the user to enter the Name of the new project ....but now do I get that input box to add the project name the user enters to the list of projects on the excel sheet?



    Hopefully that makes sense, let me know.


    Quote Originally Posted by Norie View Post
    You've kind of lost me I'm afraid.

    What do you see as an alternative to storing, somewhere, the list of projects?

    If you wanted to alter the code so the 'list' was hard -coded then things are going to get pretty complicated.

  23. #23
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    I guess in a nutshell what Im asking (simplified) is how do I take the value entered in an inputbox on a userform and pass it to a cell on a worksheet- this code isnt complete - but it kind of shows what Id be trying to do:

    Please Login or Register  to view this content.
    The issue here is okay it will add the value of the inputbox to A5, but what about when a user wants to enter another new project, the next value will need to go to A6, then A7, then A8, and so on.

    Which means if my list thats populating the combo-box right now only covers A1:A5 how do I get the list to continually expand as project names are added?
    Last edited by excelenergy; 07-12-2014 at 06:25 PM.

  24. #24
    Forum Contributor
    Join Date
    06-06-2012
    Location
    Toronto, ON
    MS-Off Ver
    Office 365
    Posts
    138

    Re: Copy Text in 1 userform textbox to a different userform textbox

    Im able to get the input box to write to a cell now ....Now Im just trying to work on making the list I made dynamic. The list is named "Project", I tried adding this code, but it doesnt continuously expand the list as project names are added:

    Please Login or Register  to view this content.

+ 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. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  2. Userform to search textbox value to place other textbox values in worksheet
    By mattyh555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:38 AM
  3. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  4. Userform Textbox updating a another userform textbox (im stuck!!)
    By wapwap in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-31-2011, 02:56 PM

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