+ Reply to Thread
Results 1 to 4 of 4

Transferring ListBox Value from Userform to Cell

  1. #1
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    154

    Transferring ListBox Value from Userform to Cell

    Hi Everyone - I am new to Excel Forum. Here is my question. Basically, I have a UserForm with multiple ListBox. The ListBox value will equal a cell value when it is called, and will also transfer its value to the cell when a command button is clicked (I am not using a control source as I want the user to be able to cancel its entries from the UserForm).

    Everything works fine, except when the UserForm is called and a user does not change the listbox value, when hitting the "enter" command button, the listbox value that transfers to the cell is blank, even though when the userform was loaded, the listbox value was set equal to the cell value.

    Here is the code for when the userform ok button is clicked.

    Private Sub OKButton5_Click()

    Range("model_units").Value = Format(model, "#,##0.00")
    Range("parking").Value = Format(parking, "#,##0.00")
    Range("laundry").Value = Format(laundry, "#,##0.00")
    Range("other_1").Value = Format(other1, "#,##0.00")
    Range("other_2").Value = Format(other2, "#,##0.00")
    Range("other_3").Value = Format(other3, "#,##0.00")

    Range("other_rev_meas2").Value = otherrevmeas2.Value
    Range("other_rev_meas3").Value = otherrevmeas3.Value
    Range("other_rev_meas4").Value = otherrevmeas4.Value
    Range("other_rev_meas5").Value = otherrevmeas5.Value
    Range("other_rev_meas6").Value = otherrevmeas6.Value


    Unload Me

    End Sub


    And here is the code for when the userform is loaded:


    Sub callotherrev()
    OtherRevenueAssump.model.Value = Format(Range("model_units"), "#,##0.00")
    OtherRevenueAssump.parking.Value = Format(Range("parking"), "#,##0.00")
    OtherRevenueAssump.laundry.Value = Format(Range("laundry"), "#,##0.00")
    OtherRevenueAssump.other1.Value = Format(Range("other_1"), "#,##0.00")
    OtherRevenueAssump.other2.Value = Format(Range("other_2"), "#,##0.00")
    OtherRevenueAssump.other3.Value = Format(Range("other_3"), "#,##0.00")

    OtherRevenueAssump.otherrevmeas2.Value = Range("other_rev_meas2")
    OtherRevenueAssump.otherrevmeas3.Value = Range("other_rev_meas3")
    OtherRevenueAssump.otherrevmeas4.Value = Range("other_rev_meas4")
    OtherRevenueAssump.otherrevmeas5.Value = Range("other_rev_meas5")
    OtherRevenueAssump.otherrevmeas6.Value = Range("other_rev_meas6")




    OtherRevenueAssump.Show


    End Sub

    Please help!

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Transferring ListBox Value from Userform to Cell

    Hi jkj115,

    Welcome to the Forum.

    Please read the Forum rules and Wrap your Code as stipulated in the Rules. Only then we may help you.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Contributor
    Join Date
    09-25-2012
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    154

    Re: Transferring ListBox Value from Userform to Cell

    Hi Everyone - I am new to Excel Forum. Here is my question. Basically, I have a UserForm with multiple ListBox. The ListBox value will equal a cell value when it is called, and will also transfer its value to the cell when a command button is clicked (I am not using a control source as I want the user to be able to cancel its entries from the UserForm).

    Everything works fine, except when the UserForm is called and a user does not change the listbox value, when hitting the "enter" command button, the listbox value that transfers to the cell is blank, even though when the userform was loaded, the listbox value was set equal to the cell value.

    Here is the code for when the userform ok button is clicked.

    Please Login or Register  to view this content.

    And here is the code for when the userform is loaded:


    Please Login or Register  to view this content.
    Please help!

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Transferring ListBox Value from Userform to Cell

    Hi jkj115,

    Could you please upload a sample of your WorkBook Complete with the Code, for us to have a look at. We are not always so keen to recreate what we think you may have, and ending up, having to do it over again. LOL.

+ 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