'EXCEL for Mac
Need 200 checkbox simulated but checkbox slows excel down.
Trying to toggle the same cell between two Custom values repeatedly. As in clicking the same cell as second Time while active.
Application.ontime
function does not work for me in the following code: 'I have allowed all Macros to execute.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Or Target.Address = "$A$2" Then
Exit Sub
End If
' Check if the value of the active cell matches cell A1
If ActiveCell.Value <> Range("A1").Value Then
' Assign the active cell to cell A1
ActiveCell.Value = Range("A1").Value
Else
ActiveCell.Value = Range("B1").Value
End If
' Call the CheckActiveCellValue subroutine
'CheckActiveCellValue
' To allow triggering the event even when clicking on the same cell,
' you can call the event manually using Application.OnTime
' WILL NOT WORK
'Application.OnTime Now + TimeValue("00:00:01"), "TriggerSelectionChangeX"
'Application.OnTime TimeValue(Now() + TimeSerial(0, 1, 0)), "TriggerSelectionChangeX"
End Sub
Sub TriggerSelectionChangex()
Worksheet_SelectionChange Selection
End Sub
Sub HelloWorld()
MsgBox "Hello World"
Application.OnTime TimeValue(Now() + TimeSerial(0, 1, 0)), "HelloWorld"
End Sub
In the example above after the first execution at 17:00, will repeat after every 1 minute.
This code does work for ticking my custom on and off checkbox graphics. But I cant seem to click the same cell to toggle the value. I've ticked on the Allow all Macros to execute setting.
Aucun commentaire:
Enregistrer un commentaire