View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default check and uncheck macro

I bet you used the ActiveX version of the checkbox--it's the one you see in the
developer's tab (unless you show more controls (IIRC)).


Option Explicit
Private Sub CheckBox11_Change()
Dim RngToCopy As Range
Dim DestCell As Range

If Me.CheckBox1.Value = True Then
Set RngToCopy = Me.Range("c11")
Set DestCell = Me.Range("c17")
RngToCopy.Copy
DestCell.pastespecial paste:=xlpastevalues

Else
Set RngToCopy = Me.Range("b29:b35")
Set DestCell = Me.Range("c11")

RngToCopy.Copy
DestCell.pastespecial paste:=xlpastevalues

'or not pasting values:

RngToCopy.Copy _
destination:=destcell


End If



End Sub

wrote:

<<snipped

Hi Dave,
Can you guide me more please.
My checkbox is number 11 in a spreadsheet, in a tab name May.

the first task is to copy c11 to c17 and paste special as a value if I
check the box, the second option is if I uncheck the box go and copy
b29 to b35 and paste it in c11 to c17.
yes is a ceck box from the developer tab under form controls.

How do I enter the code that you gave me?

Thank you!!!


--

Dave Peterson