Results 1 to 2 of 2

Thread: Userfom - Checkbox

  1. #1

    Userfom - Checkbox



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello, I want to make this code working on my Userform1, which has checkbox in It. Userform1 is activated with macro1(Userform1.Show) on worksheet (button). Code works great wih no Userfom :


    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim blnValue As Boolean
    Dim shpCB As Shape
    If Target.Count = 1 Then
      If Not Intersect(Target, Range("C4,C6")) Is Nothing Then
        blnValue = WorksheetFunction.CountA(Range("C4,C6")) = 2
        For Each shpCB In ActiveSheet.Shapes
          If shpCB.Name Like "Check*" Then
            shpCB.ControlFormat.Value = blnValue * -1
          End If
        Next shpCB
      End If
    End If
    End Sub

  2. #2
    Solution :

    http://www.mrexcel.com/forum/excel-q...ml#post3720908

    or in code:

    Code:
    Option Explicit
    
    
    Private Sub UserForm_Initialize()
    Me.CheckBox1 = application.WorksheetFunction.CountA(Sheet1.Range("E4,E6")) = 2
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •