B
Bill D.
I have a list of items and prices which can be selected with a checkbox.
When the checkbox is selected the unit price is added to the sub total.
When checkbox is deselected the unit price is subtracted from the sub
total.
There will be cases where the unit price cell is empty. When the
checkbox is selected the user will enter a price via an input box . In
this instance when the checkbox is deselected the unit price must be
subtracted from the sub total AND the unit price cell cleared.
Example:
Item 1 $100
Item 2 $125
Item 3 blank cell
Item 4 $25
I have the following code that works EXCEPT it will not clear the price
cell when the checkbox is deselected (OFF)
MyRoutineCheckBox:
With ActiveSheet.CheckBoxes(buttonclicked)
If ActiveSheet.CheckBoxes(buttonclicked).Value = _
xlOn Then
If Cells(.TopLeftCell.Row, vColumn) = "" Then _
Cells(.TopLeftCell.Row, vColumn) = _
Application.InputBox(Prompt:="Enter Amount")
End If
Cells(vSubTotalRow, vColumn) = Cells(vSubTotalRow, _
vColumn) + Cells(.TopLeftCell.Row, vColumn)
Else
Cells(vSubTotalRow, vColumn) = Cells(vSubTotalRow, _
vColumn) - Cells(.TopLeftCell.Row, vColumn)
End If
End With
Return
When the checkbox is selected I test for an empty cell and open the
input box. I need a way to set a flag for that cell so when the checkbox
is deselected I can test to see if the contents of the cell should be
deleted.
Bill
There are 10 types of people; those that understand binary and those
that don't.
When the checkbox is selected the unit price is added to the sub total.
When checkbox is deselected the unit price is subtracted from the sub
total.
There will be cases where the unit price cell is empty. When the
checkbox is selected the user will enter a price via an input box . In
this instance when the checkbox is deselected the unit price must be
subtracted from the sub total AND the unit price cell cleared.
Example:
Item 1 $100
Item 2 $125
Item 3 blank cell
Item 4 $25
I have the following code that works EXCEPT it will not clear the price
cell when the checkbox is deselected (OFF)
MyRoutineCheckBox:
With ActiveSheet.CheckBoxes(buttonclicked)
If ActiveSheet.CheckBoxes(buttonclicked).Value = _
xlOn Then
If Cells(.TopLeftCell.Row, vColumn) = "" Then _
Cells(.TopLeftCell.Row, vColumn) = _
Application.InputBox(Prompt:="Enter Amount")
End If
Cells(vSubTotalRow, vColumn) = Cells(vSubTotalRow, _
vColumn) + Cells(.TopLeftCell.Row, vColumn)
Else
Cells(vSubTotalRow, vColumn) = Cells(vSubTotalRow, _
vColumn) - Cells(.TopLeftCell.Row, vColumn)
End If
End With
Return
When the checkbox is selected I test for an empty cell and open the
input box. I need a way to set a flag for that cell so when the checkbox
is deselected I can test to see if the contents of the cell should be
deleted.
Bill
There are 10 types of people; those that understand binary and those
that don't.