Conditional Formatting - Need more than 3 formats


Posted by Zif on June 13, 2000 12:56 PM

I need to create 5 different formats based on the value of a cell as part of an AddIn I'm creating.

I don't want to use Worksheet_Change to change the ColorIndex as the sheet is password protected and I'd need to put the unprotect password into the macro - and I've had AddIn/VBA module passwords cracked before (I'm using Excel 97).

Conditional Formatting only allows you to specify 3 formats. I've tried recording the steps involved in setting up Conditional Formatting and then adding to the code, but if I try to add additional conditions, the macro returns an error.

Any suggestions as to how I can get round this?



Posted by mads on June 17, 0100 3:56 AM


Sample code :-

If Selection.Value = "XXXXX" Then
'Put your format code here
ElseIf Selection.Value = "XXXX" Then
'Put your format code here
'Repeat ElseIf and your format code as many times as required
End If

mads