Beruflich Dokumente
Kultur Dokumente
1 of 4
https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...
Home Page
-ExcelforBeginners
Kristoff deCunha.
Excel Formulas
VBA CODES
Miscellaneous
AVERAGE
Average of
Average's
AGE or TENURE
CHARTS
CONCATENATE
CONDITIONAL
FORMATTING
CONDITIONAL
FORMATTING (More
than 3 Criteria's)
The steps below will show you how to do more than 3 conditional formattings in an excel sheet, which would otherwise allow
you only 3 conditional formattings at any one time.
The Cell colours will automatically change depending on the colour you have chosen for the Text or number you have
specified as the criteria.
STEPS IN DETAIL
CLEAN
DATE
GROUPS
IF-THEN
IF-THEN(MULTIPLE)
IF-AND
STEP
On a New Excel Sheet, go to Tools, then go to Macro, then go to Visual Basic Editor. (Or you can also simply skip the
step above and press the Alt key with the F11 key to open up the Visual Basic Editor)
IF-OR
PRODUCT(multiply)
SUM (add)
TRIM
TIME
CLOCK WITH
AUTOMATIC REFRESH
Vlookup
VALIDATION
SHORTCUT KEYS
Sitemap
STEP 2
In the new screen that you see, Right click on the Sheet1, click on Insert, then click on Module.
9/8/2014 11:59 AM
2 of 4
https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...
STEP 3 1,2
I
In Module1, copy paste the code given below, into the blank screen on the right side of the screen, just as shown in
the snapshot.
Now click on Sheet1 on the left side of the screen.
Copy paste the code given below, here aswell.
Save the sheet and close the entire sheet completely.
Note: You can change all the data highlighted in red, in the code below, depending on what numbers or what
text, you would like to format in your excel sheet.
For Example:
To change the cell colour for the text ABCD & for the numbers in the range of 1 to 3 to a colour of your choice, simply change
the number mentioned in this portion of the code (oCell.Interior.ColorIndex = 3) which currently corresponds to the
colour red (see Color Table below)
To change the Font size of the number 10 to Normal font, change the word True to False in this portion of the
code (oCell.Font.Bold = False)
You can also delete the Text or Number criteria's you dont require, such as ABCD and numbers 1 to 3 for that you'll need to delete
these 3 lines of the code, like wise for any other criteria's as well :
Case 1 To 3, "ABCD"
oCell.Interior.ColorIndex = 3
oCell.Font.Bold = True
9/8/2014 11:59 AM
3 of 4
https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...
Case Else
oCell.Interior.ColorIndex = xlNone
End Select
Next oCell
End Sub
53
52
51
49
55
56
46
12
10
47
16
45
43
50
41
13
48
44
33
54
15
38
40
36
35
37
39
9/8/2014 11:59 AM
4 of 4
ABCD
EFGH
IJKL
10
https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...
5
6
7
8
Google Sites
9/8/2014 11:59 AM