HI
I try codedone excel file that will blink if the date in the E column is greater that 4 from todays date. I almost done the code but stuck up with array code " arCellsToBlink(iCounter) = "Sheet1!E" & j " and below is the complete code
Option Explicit
Public CellCheck As Boolean
Public RunWhen As Double
Dim j As Integer
Dim i As Integer
Dim arCellsToBlink()
Dim iCounter As Integer
Dim lastrow As Integer
Public Sub dter()
Dim startdate
Dim enddate
Dim das
'Dim j As Integer
lastrow = ThisWorkbook.Sheets(1).Cells(Rows.Count, 5).End(xlUp).Row
ReDim arCellsToBlink(0 To lastrow)
For i = 2 To lastrow
startdate = ThisWorkbook.Sheets(1).Range("E" & i).Value
enddate = Now()
startdate = Format(startdate, "mm-dd-yyyy")
enddate = Format(enddate, "mm-dd-yyyy")
'MsgBox startdate & " " & enddate
das = Application.WorksheetFunction.NetworkDays(enddate, startdate)
If das = 1 Then
ThisWorkbook.Sheets(1).Range("E" & i).Interior.ColorIndex = xlNone
Else
If das = 2 Then
ThisWorkbook.Sheets(1).Range("E" & i).Interior.ColorIndex = 6
Else
If das = 3 Then
ThisWorkbook.Sheets(1).Range("E" & i).Interior.ColorIndex = 3
Else
If das >= 4 Then
ThisWorkbook.Sheets(1).Range("E" & i).Interior.ColorIndex = 3
j = i
arCellsToBlink(iCounter) = "Sheet1!E" & j
'arCellsToBlink(iCounter) = "Sheet1!E7"
iCounter = iCounter + 1
Call StartBlink
CellCheck = True
End If
End If
End If
End If
Next
End Sub
Sub StartBlink()
For iCounter = 0 To lastrow
If arCellsToBlink(iCounter) <> "" Then
If ThisWorkbook.Sheets(1).Range("E" & j).Interior.ColorIndex = 3 Then
ThisWorkbook.Sheets(1).Range("E" & j).Interior.ColorIndex = 6
Else
ThisWorkbook.Sheets(1).Range("E" & j).Interior.ColorIndex = 3
End If
End If
Next iCounter
RunWhen = Now + TimeSerial(0, 0, 1)
Application.OnTime RunWhen, "StartBlink", , True
End Sub
Sub StopBlink()
Range("A1").Interior.ColorIndex = xlAutomatic
Application.OnTime RunWhen, "StartBlink", , False
End Sub
Thanks
Thiru
Bookmarks