Results 1 to 2 of 2

Saving the value of a ListBox

Threaded View

  1. #1
    Registered User
    Join Date
    07-18-2022
    Location
    Manchester England
    MS-Off Ver
    MS365
    Posts
    91

    Saving the value of a ListBox

    I have a userForm with a ListBox taking its values from a named range. I use the following code to record the chosen value in a cell.
    Private Sub ListBox1_Click()
    If ListBox1.ListIndex <> -1 Then
    
    Sheets("Sheet1").Range("C3").Value = ListBox1.Value
    End If
    End Sub
    My problem is that when the UserForm is hidden either manually or by code, the value in C3 is cleared.
    I would like to know why this happens and how to stop it.
    I have made a simplified version of this to help with the understanding of the problem. Unfortunately in this case the value in C3 remains until the value of the listbox is changed, which is what I want to happen
    John
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating new excel document from listbox without saving c
    By bruno2580 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2020, 08:30 PM
  2. [SOLVED] Listbox not saving value
    By VBTroubles in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-06-2020, 08:44 AM
  3. Powerpoint ListBox - not saving data
    By barbet in forum PowerPoint Programming
    Replies: 0
    Last Post: 05-25-2016, 04:55 AM
  4. Help with Macro that contains opening another workbook, listbox, and saving.
    By thelegazy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2013, 03:55 PM
  5. Error on saving: ActiveX listbox "does not support saving"
    By skysurfer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2012, 06:54 PM
  6. Saving information to a listbox from cells in sheet1
    By Alheksi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-10-2010, 01:48 AM
  7. Saving & Retrieivng Multi Select ListBox Values
    By mini12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2009, 09:27 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