Results 1 to 2 of 2

Dbl Click Event Procedure

Threaded View

  1. #1
    Registered User
    Join Date
    02-21-2013
    Location
    Colorado
    MS-Off Ver
    Excel 2010
    Posts
    2

    Dbl Click Event Procedure

    Hi all,
    I need to code this Double Click Even Procedure so that when you only single click on a value in the List Box (named "PriceList"), it clears the values shown in cells C6:D6. (A hint was given to me: Assign the empty string to the range C6:D6)

    Currently, if you double click on a list box and enter a discount price in the input box, it will return the appropriate discount price. If you then single click on a model number, it leaves that discount price in cells C6:D6.

    Here is the code so far:

    Private Sub ListBoxPrice_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    
    Dim strRate As String, sngRate As Single
    Dim curPrice As Currency, curDiscPrice As Currency
    Dim shtComputers As Worksheet
    Set shtComputers = Application.Workbooks("T6-EX-E1D").Worksheets("Computers")
    
    shtComputers.Unprotect
    
    strRate = InputBox("Enter discount rate (whole number):", "Rate", 0)
    
    sngRate = Val(strRate) / 100
    
    curPrice = Application.WorksheetFunction.VLookup(ListBoxPrice.Text, Range("PriceList"), 2, False)
    
    curDiscPrice = (1 - sngRate) * curPrice
    
    shtComputers.Range("c6").Value = sngRate
    shtComputers.Range("d6").Value = curDiscPrice
    
    shtComputers.Protect
    
    End Sub
    Last edited by davesexcel; 02-21-2013 at 08:45 PM.

Thread Information

Users Browsing this Thread

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

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