+ Reply to Thread
Results 1 to 3 of 3

Deselecting a check box if cell value changes

  1. #1
    SteveR
    Guest

    Deselecting a check box if cell value changes

    Hi, I'm pretty good at Access but rarely use Excel and I need some assistance
    please. I have several columns with a total at the bottom of each. At the
    top there is a check box which copies the column and pastes to another sheet.
    It erases the column in the second, destination sheet if the check box is
    deselected. The problem is that if someone changes a value somewhere in the
    column the cells in the destination sheet do not update, you would have to
    deselect and reselect the check box. I want the deselect, select action to
    happen if the contents of the total cell change.

    Thanks for the help!

  2. #2
    JNW
    Guest

    RE: Deselecting a check box if cell value changes

    You could use the worksheet_change event for the specific worksheet. to get
    there you go to the VBA window (alt+F11) and open the code for the sheet you
    are working in. Then type something like the following:

    Private Sub WorkSheet_Change()
    Application.ScreenUpdating = False
    OnUncheck 'name of sub that runs when checkbox is unchecked
    OnCheck 'name of sub that runs when checkbox is checked
    Application.ScreenUpdating = True
    End Sub

    "SteveR" wrote:

    > Hi, I'm pretty good at Access but rarely use Excel and I need some assistance
    > please. I have several columns with a total at the bottom of each. At the
    > top there is a check box which copies the column and pastes to another sheet.
    > It erases the column in the second, destination sheet if the check box is
    > deselected. The problem is that if someone changes a value somewhere in the
    > column the cells in the destination sheet do not update, you would have to
    > deselect and reselect the check box. I want the deselect, select action to
    > happen if the contents of the total cell change.
    >
    > Thanks for the help!


  3. #3
    SteveR
    Guest

    RE: Deselecting a check box if cell value changes

    I can't get this code to work. Here is the code for one of nine similar
    check boxes:

    Private Sub Chk2037_Click()
    Dim cbCol As Long

    cbCol = Sheet1.Chk2037.BottomRightCell.Row + 11

    If Sheet1.Chk2037.Value = True Then
    Sheet1.Columns(cbCol).Copy Destination:=Sheet2.Columns(cbCol)
    ElseIf Sheet1.Chk2037.Value = False Then
    Sheet2.Columns(cbCol).ClearContents
    End If

    End Sub

    I want this code to happen if there are any changes to the cells in it's
    column. Or I can have all nine events happen if there is a change anywhere
    in the spreadsheet.

    This is the code i put in for just the one column (check box)

    Private Sub Worksheet_Change()
    Application.ScreenUpdating = False
    Chk2037 'name of sub that runs when checkbox is unchecked
    'OnCheck 'name of sub that runs when checkbox is checked
    Application.ScreenUpdating = True
    End Sub

    It gives me a complie error on the first line: "Procedure declaration does
    not match descripion of event or procedure having the same name"

    Thanks for the help.


    "JNW" wrote:

    > You could use the worksheet_change event for the specific worksheet. to get
    > there you go to the VBA window (alt+F11) and open the code for the sheet you
    > are working in. Then type something like the following:
    >
    > Private Sub WorkSheet_Change()
    > Application.ScreenUpdating = False
    > OnUncheck 'name of sub that runs when checkbox is unchecked
    > OnCheck 'name of sub that runs when checkbox is checked
    > Application.ScreenUpdating = True
    > End Sub
    >
    > "SteveR" wrote:
    >
    > > Hi, I'm pretty good at Access but rarely use Excel and I need some assistance
    > > please. I have several columns with a total at the bottom of each. At the
    > > top there is a check box which copies the column and pastes to another sheet.
    > > It erases the column in the second, destination sheet if the check box is
    > > deselected. The problem is that if someone changes a value somewhere in the
    > > column the cells in the destination sheet do not update, you would have to
    > > deselect and reselect the check box. I want the deselect, select action to
    > > happen if the contents of the total cell change.
    > >
    > > Thanks for the help!


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1