+ Reply to Thread
Results 1 to 3 of 3

Making a command button and listbox disappear after use

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    West Virginia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Making a command button and listbox disappear after use

    Hi, I am pretty new to visual basic. I was wondering if you could make a list box and command button disappear after you click off of them. I have it to where when you double click ListBox2, Listbox1 and commandbutton 2 pop up. Can you make them disappear after you click off?

    This is my code:
    Private Sub CommandButton1_Click()
    ListBox1.AddItem TextBox1.Text
    TextBox1.Text = ""
    TextBox1.Activate

    End Sub

    Private Sub CommandButton2_Click()
    ListBox2.Clear
    For i = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(i) = True Then
    ListBox2.AddItem ListBox1.List(i)

    End If
    Next
    End Sub

    Private Sub ListBox1_Click()

    End Sub

    Private Sub ListBox2_doubleClick()

    End Sub

    Private Sub ListBox2_Click()

    End Sub

    Private Sub ListBox2_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    ListBox1.Activate
    CommandButton2.Activate
    CommandButton2.Visible = True

    End Sub

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Making a command button and listbox disappear after use

    sounds like you are looking for MouseUp event

    .visible = false the components in the sub
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    06-24-2013
    Location
    West Virginia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Making a command button and listbox disappear after use

    Thanks! I actually figured it out. I'm using the keydown event. [SOLVED]

+ 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