Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Delete old data when checkbox is unchecked

Right now I have a spreadsheet with checkboxes and each one uses the
following code:

Sub SelectYes1()
Range("f6").Value = "=sheet1!b2"
End Sub

All it does is takes a value off sheet1 and then puts it into f6 but
the only problem is, once it is unchecked the value isnt deleted so my
formula bases off of that still includes that number in the total.

Could someone let me know how to construct a macro that could delete
the cell f6 when the checkboxe is unchecked.

Thank you!

-Trevor

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Delete old data when checkbox is unchecked

How about:

Sub SelectYes1()
if activesheet.checkboxes(application.caller) = xlon then
Range("f6").Value = "=sheet1!b2"
else
range("F6").value = 0 ' or "" to empty it
end if
End Sub

This works for checkboxes from the Forms toolbar.

And one of the nice things about these kinds of checkboxes is that you can
assign the same macro to each of them. But then you have to figure out someway
to know what to process.

You could use the name; you could use the location. Or anything else that was
unique.

tnederlof wrote:

Right now I have a spreadsheet with checkboxes and each one uses the
following code:

Sub SelectYes1()
Range("f6").Value = "=sheet1!b2"
End Sub

All it does is takes a value off sheet1 and then puts it into f6 but
the only problem is, once it is unchecked the value isnt deleted so my
formula bases off of that still includes that number in the total.

Could someone let me know how to construct a macro that could delete
the cell f6 when the checkboxe is unchecked.

Thank you!

-Trevor


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
ranking query JaimeTimbrell Excel Discussion (Misc queries) 2 February 16th 06 08:09 AM
delete duplicate record but only determine 1 column data AskExcel Excel Worksheet Functions 3 January 28th 06 01:11 PM
Inserting a new line when external data changes Rental Man Excel Discussion (Misc queries) 0 January 11th 06 07:05 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"