Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50243

Dbl Click Event Procedure

$
0
0
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

Viewing all articles
Browse latest Browse all 50243

Trending Articles