Check Box help
Hi I have a macro which will input a default value into a cell when run and I have assigned a check box to the macro. What I want to do is - If the check box is checked the macro runs and the default value is inserted (that bits OK). Now what I want to do is if the user inputs there own value the check box, unchecks itself to show the default has not been used. All help appreciated. -- Donkin ------------------------------------------------------------------------ Donkin's Profile: http://www.excelforum.com/member.php...o&userid=23715 View this thread: http://www.excelforum.com/showthread...hreadid=373897 |
Maybe you can use a worksheet_change event to look for a change to that cell.
I used a checkbox (named "check box 1") from the Forms toolbar and looked for a change to A1: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub If Intersect(Me.Range("a1"), Target) Is Nothing Then Exit Sub Me.CheckBoxes("check box 1").Value = xlOff End Sub rightclick on the worksheet tab that should have this behavior. Select view code. Paste this in. Adjust the name/range accordingly. Donkin wrote: Hi I have a macro which will input a default value into a cell when run and I have assigned a check box to the macro. What I want to do is - If the check box is checked the macro runs and the default value is inserted (that bits OK). Now what I want to do is if the user inputs there own value the check box, unchecks itself to show the default has not been used. All help appreciated. -- Donkin ------------------------------------------------------------------------ Donkin's Profile: http://www.excelforum.com/member.php...o&userid=23715 View this thread: http://www.excelforum.com/showthread...hreadid=373897 -- Dave Peterson |
Use the change event for the cell input. something like this Right click on the sheet-tab name, view code, and enter following code: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then ' keep only one line from the following Range("B1") = False ' if you are using forms menu check box CheckBox1.Value = False ' if you are using Control Toolbox menu check box End If End Sub Where A1 is the input cell, B1 is the cell linked to your check box if you have the Forms menu checkbox. Mangesh -- mangesh_yadav ------------------------------------------------------------------------ mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470 View this thread: http://www.excelforum.com/showthread...hreadid=373897 |
All times are GMT +1. The time now is 05:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com