filmov
tv
Excel Blinking Cells VBA Code
Показать описание
Excel Blinking Cell VBA
0:00 Introduction blinking cell
0:34 Developer tab
0:57 VBA code overview
2:57 Blinking cell variables
3:24 Storing all cells
4:10 Add blinking
Below you can find the VBA codes that we used in this Excel Blinking Cell VBA tutorial:
'Initializing variables
Dim score As Range
Set score = Range("C3", Range("C3").End(xlDown))
Dim scoreValue As Range
Dim blinkingCellsVect As Range
Dim highlightCellsVect As Range
Dim targetValue As Range
Set targetValue = Range("F2")
-------------------------
'Storing all cells to highlight
If Not Intersect(Target, Union(score, targetValue)) Is Nothing Then
For Each scoreValue In score
If scoreValue.Value > targetValue.Value Then
If highlightCellsVect Is Nothing Then
Set highlightCellsVect = scoreValue
Else
Set highlightCellsVect = Union(highlightCellsVect, scoreValue)
End If
ElseIf scoreValue.Value > targetValue.Value - 500 And scoreValue.Value < targetValue.Value Then
If blinkingCellsVect Is Nothing Then
Set blinkingCellsVect = scoreValue
Else
Set blinkingCellsVect = Union(blinkingCellsVect, scoreValue)
End If
End If
Next scoreValue
------------------------
'Color cells and add blinking
highlightCellsVect.Interior.ColorIndex = 35
For i = 1 To 3
blinkingCellsVect.Interior.ColorIndex = 36
Application.Wait (Now + TimeValue("0:00:01"))
blinkingCellsVect.Interior.ColorIndex = 0
Application.Wait (Now + TimeValue("0:00:01"))
blinkingCellsVect.Interior.ColorIndex = 36
Application.Wait (Now + TimeValue("0:00:01"))
Next i
End If
End Sub
---------------
This concludes our Excel Blinking Cell VBA tutorial. I'm inspired by content creators as Leila Gharani and Teacher's Tech.
#Excel #Tutorial #VBA
0:00 Introduction blinking cell
0:34 Developer tab
0:57 VBA code overview
2:57 Blinking cell variables
3:24 Storing all cells
4:10 Add blinking
Below you can find the VBA codes that we used in this Excel Blinking Cell VBA tutorial:
'Initializing variables
Dim score As Range
Set score = Range("C3", Range("C3").End(xlDown))
Dim scoreValue As Range
Dim blinkingCellsVect As Range
Dim highlightCellsVect As Range
Dim targetValue As Range
Set targetValue = Range("F2")
-------------------------
'Storing all cells to highlight
If Not Intersect(Target, Union(score, targetValue)) Is Nothing Then
For Each scoreValue In score
If scoreValue.Value > targetValue.Value Then
If highlightCellsVect Is Nothing Then
Set highlightCellsVect = scoreValue
Else
Set highlightCellsVect = Union(highlightCellsVect, scoreValue)
End If
ElseIf scoreValue.Value > targetValue.Value - 500 And scoreValue.Value < targetValue.Value Then
If blinkingCellsVect Is Nothing Then
Set blinkingCellsVect = scoreValue
Else
Set blinkingCellsVect = Union(blinkingCellsVect, scoreValue)
End If
End If
Next scoreValue
------------------------
'Color cells and add blinking
highlightCellsVect.Interior.ColorIndex = 35
For i = 1 To 3
blinkingCellsVect.Interior.ColorIndex = 36
Application.Wait (Now + TimeValue("0:00:01"))
blinkingCellsVect.Interior.ColorIndex = 0
Application.Wait (Now + TimeValue("0:00:01"))
blinkingCellsVect.Interior.ColorIndex = 36
Application.Wait (Now + TimeValue("0:00:01"))
Next i
End If
End Sub
---------------
This concludes our Excel Blinking Cell VBA tutorial. I'm inspired by content creators as Leila Gharani and Teacher's Tech.
#Excel #Tutorial #VBA
Комментарии