Consulting

Results 1 to 4 of 4

Thread: Writing a Macro for Checkbox Form

  1. #1

    Writing a Macro for Checkbox Form

    Hi, I'm using Excel 2003. If I use a forms checkbox, and the user will check it or not. If the user doesn't check the box then input is required in the next cell. However if the user checks the box I don't want them to put anything in the next cell. Is there a way to accomplish this?

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Change the formating of all the cells on the sheet to UnLocked.
    Then Assign the checkbox to this macro.
    [VBA]Sub CheckBox1_Click()
    With ActiveSheet
    .Unprotect
    .Range("A1").Locked = CBool(.Shapes(Application.Caller).ControlFormat.Value And 1)
    .Protect
    End With
    End Sub[/VBA]

  3. #3
    Thanks!

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    A non-VB approach would be to link the check-box to a cell (B1 in this example). And then put Validation on the cell that you want it to control, with the formula =NOT($B$1)

Posting Permissions

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