M
MAX
I have these codes (below) in 2 seperate sheets. Is it possible to use these
codes in one sheet?
If yes, where and how I have to put them?
These are the 2 codes:
1st Code:
In Workbook:
-------------------
Private Sub Workbook_Open()
StartBlink1
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink1
End Sub
In Module:
--------------
Public RunWhen As Double
Sub StartBlink1()
With ThisWorkbook.Worksheets("Champions League").Range("A2").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, "StartBlink1", , True
End Sub
Sub StopBlink1()
ThisWorkbook.Worksheets("CHAMPIONS LEAGUE ").Range("A2").Font.ColorIndex
= _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink1", , False
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2nd Code:
In Workbook:
-------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub
Private Sub Workbook_Open()
startFlashing
End Sub
In Module:
--------------
Option Explicit
Dim nextSecond
Sub startFlashing()
flashCell
End Sub
Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub
Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"
If Range("A114").Interior.ColorIndex = 3 Then
Range("A114").Interior.ColorIndex = 5
Range("A114").Value = IIf(Range("K112") = Range("L112"),
Range("A108"), IIf(Range("K112") > Range("L112"), Range("E111"),
Range("H111")))
ElseIf Range("A114").Interior.ColorIndex = 5 Then
Range("A114").Interior.ColorIndex = 3
Range("A114").Value = "CHECKED"
End If
End Sub
codes in one sheet?
If yes, where and how I have to put them?
These are the 2 codes:
1st Code:
In Workbook:
-------------------
Private Sub Workbook_Open()
StartBlink1
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopBlink1
End Sub
In Module:
--------------
Public RunWhen As Double
Sub StartBlink1()
With ThisWorkbook.Worksheets("Champions League").Range("A2").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, "StartBlink1", , True
End Sub
Sub StopBlink1()
ThisWorkbook.Worksheets("CHAMPIONS LEAGUE ").Range("A2").Font.ColorIndex
= _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink1", , False
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2nd Code:
In Workbook:
-------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopFlashing
End Sub
Private Sub Workbook_Open()
startFlashing
End Sub
In Module:
--------------
Option Explicit
Dim nextSecond
Sub startFlashing()
flashCell
End Sub
Sub stopFlashing()
On Error Resume Next
Application.OnTime nextSecond, "flashCell", , False
End Sub
Sub flashCell()
nextSecond = Now + TimeValue("00:00:01")
Application.OnTime nextSecond, "flashCell"
If Range("A114").Interior.ColorIndex = 3 Then
Range("A114").Interior.ColorIndex = 5
Range("A114").Value = IIf(Range("K112") = Range("L112"),
Range("A108"), IIf(Range("K112") > Range("L112"), Range("E111"),
Range("H111")))
ElseIf Range("A114").Interior.ColorIndex = 5 Then
Range("A114").Interior.ColorIndex = 3
Range("A114").Value = "CHECKED"
End If
End Sub