Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Toggle Button help | Excel Programming | |||
Need help using a toggle button | Excel Programming | |||
Toggle Button | Excel Discussion (Misc queries) | |||
Adding .xla button for Toggle Calculation Button | Excel Programming | |||
Toggle Button | Excel Programming |