Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkboxes

Status
Not open for further replies.

sitrep

Technical User
Nov 29, 2007
1
GB
Hi :)
Can anyone help me with the VBA on a checkbox please - my VBA is OK but this is making me scratch my head (and it's annoying me).

I've got one product with the choice of two prices. I want to select the higher price from the price-list by ticking the checkbox and select the lower price from the price-list when the check box is not ticked (the checkbox is a toggle-switch basically).

The price selected via the checkbox feeds into a cell with an =SUM formula - this has a RANGE from Sheet2

Pricelist is on Sheet2, the =SUM formula is on Sheet1.

Many thanks.
 

Looks to me that you are using the wrong control to do so.

Can you check both prices at the same time?
Can you check none of the prices?

If the answer is: "NO", then change it to radio buttons (option buttons) instead.


Have fun.

---- Andy
 
Here is some code that may work. I placed ranges number for simplicity sake. You need to change cell number to reflect your situation.
<code>
if checkbox1.value = true then
vPrice=sheets("sheet2").range("a1").value
else
vPrice=sheets("sheet2").range("a2").value
end if

with sheets("sheet1").
.range("a2").formula = "=sum("& vprice & " +a2)"
end with
</code>
if this is not what you are looking for please post more information.

ck1999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top