View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Check box question???

Record a macro when you do the border, the data|validation and the formatting.

Then record a different macro when you remove what you want.

Then add a checkbox from the Forms toolbar (not the control toolbox toolbar) to
the worksheet.

Then assign this macro to the checkbox.

Option Explicit
Sub TestMe()

Dim CBX As CheckBox

Set CBX = ActiveSheet.CheckBoxes(Application.Caller)

If CBX.Value = xlOn Then
Call AddTheStuff
Else
Call RemoveTheStuff
End If

End Sub

I used AddTheStuff and RemoveTheStuff for the names of the macros in my testing.

You may want to change the recorded macro names to something significant--along
with the macro (TestMe isn't a very good name!).


(for testing only)

Sub AddTheStuff()
MsgBox "Your code to do the work"
End Sub
Sub RemoveTheStuff()
MsgBox "Your code to remove the work"
End Sub

Pas wrote:

Is there a way by clicking on a check box, it would do the following to a
particular cell:
1. insert a border
2. insert a data validation list
3. colour the back ground to white

and when unchecked it all disappears untill its checked again.


--

Dave Peterson