![]() |
Non Working Cells after command button
Probelm returning from command button click. When i start a command button click, I call SetTheDisplayToOff(true) (see below) to set the display and events so they not work. Then I go do a database query on another sheet, format the sheet, then activate the first sheet that I started from. The last line in my command button sub is SetTheDisplayToOff(false) to enable all events and display.. The problem is that after I click the command button, the active cell is not highlighted, clicking on a cell does not show the cell as selected, and the tab key does not advance to the next cell. This first worksheet is protected so only 5 cells are unprotected for entry. However if I save the workbook, then all works correctly. Any suggestions? Mark Gordon Public Sub SetTheDisplayToOff(displayOff As Boolean) If displayOff Then With Application ScreenUpdating = False Calculation = xlCalculationManual EnableEvents = False End With Else With Application ScreenUpdating = True Calculation = xlCalculationAutomatic EnableEvents = True StatusBar = "Ready" StatusBar = False CutCopyMode = False End With End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
Non Working Cells after command button
rlgh60'
You've set up a "Catch 22" situation. By setting EnableEvents to false, the second CommandButton_Click event is not being recognised. You'll have to re-enable events somewhere/somehow else or not set it to false. HTH Henry "rlgh60" wrote in message ... Probelm returning from command button click. When i start a command button click, I call SetTheDisplayToOff(true) (see below) to set the display and events so they not work. Then I go do a database query on another sheet, format the sheet, then activate the first sheet that I started from. The last line in my command button sub is SetTheDisplayToOff(false) to enable all events and display.. The problem is that after I click the command button, the active cell is not highlighted, clicking on a cell does not show the cell as selected, and the tab key does not advance to the next cell. This first worksheet is protected so only 5 cells are unprotected for entry. However if I save the workbook, then all works correctly. Any suggestions? Mark Gordon Public Sub SetTheDisplayToOff(displayOff As Boolean) If displayOff Then With Application ScreenUpdating = False Calculation = xlCalculationManual EnableEvents = False End With Else With Application ScreenUpdating = True Calculation = xlCalculationAutomatic EnableEvents = True StatusBar = "Ready" StatusBar = False CutCopyMode = False End With End Sub ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 01:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com