Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deselecting Worksheets Sloth Excel Discussion (Misc queries) 1 October 26th 05 09:31 PM
Deselecting sheets after the PrintOut method [email protected] Excel Programming 1 September 3rd 05 12:29 AM
deselecting... cellardoor Excel Programming 1 July 25th 05 09:15 PM
Deselecting unwanted cells Octavio New Users to Excel 3 March 12th 05 03:04 PM


All times are GMT +1. The time now is 07:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"