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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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/



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
Form command not working on worksheet with merged cells JohnH Excel Discussion (Misc queries) 0 May 17th 10 01:28 PM
print 20 cells with a command button [email protected] Excel Discussion (Misc queries) 5 February 3rd 08 05:57 PM
command button isn't working Nydia New Users to Excel 1 April 29th 05 10:31 PM
Using Command Button to copy cells Pennington Excel Discussion (Misc queries) 1 April 29th 05 02:30 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 06:59 AM.

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

About Us

"It's about Microsoft Excel"