Arrange code

M

MAX

Hello
I have this code (below) which works perfect.
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("A105").Interior.ColorIndex = 3 Then
Range("A105").Interior.ColorIndex = 5
Range("A105").Value = IIf(Range("F102") = Range("G102"),
Range("A99"), IIf(Range("F102") > Range("G102"), Range("E102"),
Range("H102")))
ElseIf Range("A105").Interior.ColorIndex = 5 Then
Range("A105").Interior.ColorIndex = 3
Range("A105").Value = "CHAMPIONS 2009-2010"
End If
End Sub

Now I need to add something else to it, where if cells F102 and G102 remain
equal, then Range("A105").Value =
Range(J102)>Range(K102),Range(E102),Range(H102).
I appriciate even a small help.
Thanks in advance.
 
J

JLGWhiz

then Range("A105").Value =
Range(J102)>Range(K102),Range(E102),Range(H102).


This needs clarification. Did you want an IIf statement

Or

A105 = The greater of J102 Or Sum(E102, H102, K102)

Or

A105 = Sum(E102, H102, J102,K102) assuming the > was a typo.

Or what?
 
J

JLGWhiz

I went ahead with the assumption that you wanted an additional ElseIf
statement. This would be inserted just before the End If.


ElseIf Range("F102") = Range("G102") Then
Range("A105") = IIf(Range("J102") > Range("k102"), _
Range("E102"), Range("H102"))
 
J

JLGWhiz

That got all skewed around, hopefully this will look better and won't wrap
when it posts.


ElseIf Range("F102") = Range("G102") Then
Range("A105") = IIf(Range("J102") > Range("k102"), _
Range("E102"), Range("H102"))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Compile error 7
Adding code 5
Adding code 1
Code arrangement 3
2 codes in one sheet 5
Code help 6
Two codes in one set. 1
Cells flashing 2

Top