Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Max,
Do your protection at runtime and protect the userinterface only. As an example you could do it in your workbook open event code Private Sub Workbook_Open() Sheets("serie A").Protect Password:="password", UserInterfaceOnly:=True StartBlink StartBlink2 StartBlink3 End Sub Mike "MAX" wrote: I have a code (below), that blinks certain cells in a workbook where it works perfect, but when I protect the workbook it stops working and it is giving me a (Run Time Error 1004). Is there a solution for this? Thanks a lot. Workbook code: Private Sub Workbook_Open() StartBlink StartBlink2 StartBlink3 End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink StopBlink2 StopBlink3 End Sub Module Code: Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("Serie A").Range("AN6,AW6").Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 31 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("Serie A").Range("AN6,AW6").Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "StartBlink", , False End Sub Sub StartBlink2() With ThisWorkbook.Worksheets("Serie B").Range("AN6,AW6").Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "StartBlink2", , True End Sub Sub StopBlink2() ThisWorkbook.Worksheets("Serie B").Range("AN6,AW6").Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "StartBlink2", , False End Sub Sub StartBlink3() With ThisWorkbook.Worksheets("Serie C").Range("AN6,AW6,AN83,AW83").Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "StartBlink3", , True End Sub Sub StopBlink3() ThisWorkbook.Worksheets("Serie C").Range("AN6,AW6,AN83,AW83").Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "StartBlink3", , False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protected Formula Error | Excel Programming | |||
Protected formula error. | Excel Discussion (Misc queries) | |||
1004 Cell Protected Error for data validation lists when locked and protected | Excel Programming | |||
Error 91 but only when sheet is protected | Excel Programming | |||
Cell Protected Error | Excel Programming |