Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default Toggle Button

I have 5 togglebutton controls on a worksheet. When they are toggled on a
range of cells are highlighted and unlocked. When they are toggled off the
range of cell are unhighlited and locked is turned on. The problem I have is
the toggle button can be toggled off before the enter key has been pressed
when making changes to the cell. Is there a way to disable the toggle button
when data is started to be typed into a cell until the enter key is pressed
or another cell is selected?
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Toggle Button

On Jul 30, 5:31*pm, ranswrt wrote:
I have 5 togglebutton controls on a worksheet. *When they are toggled on a
range of cells are highlighted and unlocked. *When they are toggled off the
range of cell are unhighlited and locked is turned on. *The problem I have is
the toggle button can be toggled off before the enter key has been pressed
when making changes to the cell. *Is there a way to disable the toggle button
when data is started to be typed into a cell until the enter key is pressed
or another cell is selected?
Thanks


Right click the sheet you are working in and go to view code... enter
the following...

'=================================================
' The code below will invoke a macro to run when someone clicks a cell
so in this case you can have it disable that toggle button...
'=================================================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ToggleButton1.Enabled = False
End Sub

'=================================================
' The code below will invoke a macro after someone finished entering
data into a cell...
'=================================================
Private Sub Worksheet_Calculate()
ToggleButton1.Enabled = True
End Sub


'---------------------------------------- You could also try this
below for a similar effect (not sure what)
Private Sub Worksheet_Change(ByVal Target As Range)

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default Toggle Button

That works except for when there is only cell unlocked on the sheet. Any
ideas on how to get around that?

" wrote:

On Jul 30, 5:31 pm, ranswrt wrote:
I have 5 togglebutton controls on a worksheet. When they are toggled on a
range of cells are highlighted and unlocked. When they are toggled off the
range of cell are unhighlited and locked is turned on. The problem I have is
the toggle button can be toggled off before the enter key has been pressed
when making changes to the cell. Is there a way to disable the toggle button
when data is started to be typed into a cell until the enter key is pressed
or another cell is selected?
Thanks


Right click the sheet you are working in and go to view code... enter
the following...

'=================================================
' The code below will invoke a macro to run when someone clicks a cell
so in this case you can have it disable that toggle button...
'=================================================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ToggleButton1.Enabled = False
End Sub

'=================================================
' The code below will invoke a macro after someone finished entering
data into a cell...
'=================================================
Private Sub Worksheet_Calculate()
ToggleButton1.Enabled = True
End Sub


'---------------------------------------- You could also try this
below for a similar effect (not sure what)
Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

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
Toggle Button help jonco Excel Programming 3 February 7th 07 02:46 AM
Need help using a toggle button tanktata[_6_] Excel Programming 5 June 28th 06 08:01 PM
Toggle Button mick2 Excel Discussion (Misc queries) 5 November 27th 05 05:52 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Toggle Button Keri[_2_] Excel Programming 2 May 28th 04 04:58 PM


All times are GMT +1. The time now is 08:56 PM.

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"