Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
Hello
I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
Yes, Just copy the 3-lines from the ElseIf group and paste it right below
that group and then modify it as needed to test for and set the color index of D7 and to set the value to = "Media". "MAX" wrote: Hello I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
You will need ot add in the missing info below.
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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" ElseIf Range("D7").Interior.ColorIndex = 5 Then Range("D7").Interiror.ColorIndex = ? '<<<<You did not specify Range("D7").Value = "Media" End If End Sub "MAX" wrote in message ... Hello I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
I did that but it did not work. Will you please do the code for me since I am
a very beginner. Thanks a lot "JLatham" wrote: Yes, Just copy the 3-lines from the ElseIf group and paste it right below that group and then modify it as needed to test for and set the color index of D7 and to set the value to = "Media". "MAX" wrote: Hello I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
I want Interior.ColorIndex 5 and Interior.ColorIndex 3
"MAX" wrote: Hello I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding code
Try this:
Sub flashCell() nextSecond = Now + TimeValue("00:00:01") Application.OnTime nextSecond, "flashCell" If Range("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 5 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 5 Then Range("D7").Interior.ColorIndex = 3 Range("D7").Value = "EDUCATION" ElseIf Range("D7").Interior.ColorIndex = 3 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "Media" Else 'to kick it all off Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "Media" End If End Sub "MAX" wrote: I did that but it did not work. Will you please do the code for me since I am a very beginner. Thanks a lot "JLatham" wrote: Yes, Just copy the 3-lines from the ElseIf group and paste it right below that group and then modify it as needed to test for and set the color index of D7 and to set the value to = "Media". "MAX" wrote: Hello I have this code (below) and I wish to add another Interior.ColorIndex 5 and another Value "Media". Is this possible? 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("D7").Interior.ColorIndex = 4 Then Range("D7").Interior.ColorIndex = 6 Range("D7").Value = "SPORT" ElseIf Range("D7").Interior.ColorIndex = 6 Then Range("D7").Interior.ColorIndex = 4 Range("D7").Value = "EDUCATION" End If End Sub Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating excel file, adding code to it from code, VBE window stays | Excel Programming | |||
adding code lines with vba code | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
adding to a VBA COde | Excel Programming | |||
Adding space to VBA code | Excel Programming |