jatansanand
New Member
- Joined
- Aug 16, 2013
- Messages
- 1
I have this excel document with a Finansu Add-in that pulls live stock feeds from Google Finance. As of now, if the % change is negative overall then the cell is red and if it is positive it is green. I want to find a way to make it so if the stock changed from 1% down to .5% down the cell will flash green for a second or 2 and then go back to being red. And all of those variations. I know that I will most likely have to use VBA to do this. Not sure how though.
Currently I have 3 modules in my excel file.
Module 1:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing
Then
oldval = myval
If Target.Value > oldval Then
Range(J7:N18 & Target.Row).Interior.ColorIndex =
4
Else
Range(J7:N18 & Target.Row).Interior.ColorIndex =
3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing
Module 2:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing Then
oldval = myval
If Target.Value > oldval Then
Range(J7:N18 & Target.Row).Interior.ColorIndex = 4
Else
Range(J7:N18 & Target.Row).Interior.ColorIndex = 3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing Then
myval = Target.Value
End If
End Sub
Module 3:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J8:N17)) Is Nothing
Then
oldval = myval
If Target.Value > oldval Then
Range(J8:N17 & Target.Row).Interior.ColorIndex =
4
Else
Range(J8:N17 & Target.Row).Interior.ColorIndex =
3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Not Intersect(Target, Range(J7:N8)) Is Nothing
Sub COLORS()
End Sub
Thank you.
Currently I have 3 modules in my excel file.
Module 1:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing
Then
oldval = myval
If Target.Value > oldval Then
Range(J7:N18 & Target.Row).Interior.ColorIndex =
4
Else
Range(J7:N18 & Target.Row).Interior.ColorIndex =
3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing
Module 2:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing Then
oldval = myval
If Target.Value > oldval Then
Range(J7:N18 & Target.Row).Interior.ColorIndex = 4
Else
Range(J7:N18 & Target.Row).Interior.ColorIndex = 3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range(J7:N18)) Is Nothing Then
myval = Target.Value
End If
End Sub
Module 3:
Public oldval, myval
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range(J8:N17)) Is Nothing
Then
oldval = myval
If Target.Value > oldval Then
Range(J8:N17 & Target.Row).Interior.ColorIndex =
4
Else
Range(J8:N17 & Target.Row).Interior.ColorIndex =
3
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Not Intersect(Target, Range(J7:N8)) Is Nothing
Sub COLORS()
End Sub
Thank you.