Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
I Need Help To Do This Code In A Macro
If need help make this code in a macro !! . Variable CLI - Macro BR = Business Relevance n-r = non-relevant ----------------------------------------------------------- IF BR = “n-r” THEN BEGIN (1) If KI < 1.5 then begin write “CLS 11” write “overqualified” SelectColor = Turquise end else if 1.5 <= KI < 2.5 then begin write “CLS 12” write “overqualified” SelectColor = Turquise end else if 2.5 <= KI then begin write “CLS 13” write “overqualified” SelectColor = Turquise end END (1) ----------------------------------------------------------- ELSE IF BR = “medium” THEN BEGIN (2) If KI < 1.5 then begin write “CLS 04” write “OK” SelectColor = Bright Green end else if 1.5 <= KI < 2.5 then begin write “CLS 05” write “OK” SelectColor = Bright Green end else if 2.5 <= KI then begin write “CLS 16” write “overqualified” SelectColor = Turquise end END (2) ----------------------------------------------------------- ELSE IF BR = “high” THEN BEGIN (3) If KI < 1.5 then begin write “CLS -27” write “critical” SelectColor = Red end else if 1.5 <= KI < 2.5 then begin write “CLS -18” write “needs improvement” SelectColor = Light Yellow end else if 2.5 <= KI then begin write “CLS 09” write “OK” SelectColor = Bright Green end END (3) ----------------------------------------------------------- ELSE BEGIN (4) write “ERROR” END (4 -- dpji ----------------------------------------------------------------------- dpjim's Profile: http://www.excelforum.com/member.php...fo&userid=2514 View this thread: http://www.excelforum.com/showthread.php?threadid=38672 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
I Need Help To Do This Code In A Macro
Not exactly sure about the content, but this shows the basic structure The indendation helps here.:- Code ------------------- Sub untested() ' TO SHOW CODE STRUCTURE ONLY Dim MyCell As Range MyCell = ActiveSheet.Range("A1") '------------------------------------------------- Select Case BR Case Is = "n - r" If KI < 1.5 Then MyCell.Value = "CLS 11" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 1.5 <= KI < 2.5 Then MyCell.Value = "CLS 12" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 2.5 <= KI Then MyCell.Value = "CLS 13" & " overqualified" MyCell.Interior.ColorIndex = 42 End If Case Is = "medium" If KI < 1.5 Then MyCell.Value = "CLS 11" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 1.5 <= KI < 2.5 Then MyCell.Value = "CLS 12" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 2.5 <= KI Then MyCell.Value = "CLS 13" & " overqualified" MyCell.Interior.ColorIndex = 42 End If Case Is = "high" If KI < 1.5 Then MyCell.Value = "CLS 11" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 1.5 <= KI < 2.5 Then MyCell.Value = "CLS 12" & " overqualified" MyCell.Interior.ColorIndex = 42 ElseIf 2.5 <= KI Then MyCell.Value = "CLS 13" & " overqualified" MyCell.Interior.ColorIndex = 42 End If End Select End Sub ------------------- -- Brian ----------------------------------------------------------------------- BrianB's Profile: http://www.excelforum.com/member.php...tinfo&userid=5 View this thread: http://www.excelforum.com/showthread.php?threadid=38672 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting code from a macro (by a macro) | Excel Discussion (Misc queries) | |||
Macro copying macro code | Excel Programming | |||
Macro to change Macro code? | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming |