Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

microsoft excel training - conditional formatting

Forum home » Delegate support and help forum » Microsoft Excel Training and help » microsoft excel training - Conditional Formatting

microsoft excel training - Conditional Formatting

ResolvedVersion Standard

Conditional Formatting


Is there a way to extend the range of conditional formatting to more than three conditions?

RE: Conditional Formatting

Yes, you can do it by using VBA coding. If you have not had any experience using VBA, this may be a steep learning curve.


STEPS:

Save your workbook, then activate the worksheet, right-click its Sheet Name tab, select View Code, and enter the following code:

----------------------

Private Sub Worksheet_Change(ByVal Target As Range)



Dim icolor As Integer

If Not Intersect(Target, Range("A1:A10")) is Nothing Then

Select Case Target

Case 1 To 5

icolor = 6

Case 6 To 10

icolor = 12

Case 11 To 15

icolor = 7

Case 16 To 20

icolor = 53

Case 21 To 25

icolor = 15

Case 26 To 30

icolor = 42

Case Else

'Whatever

End Select

Target.Interior.ColorIndex = icolor

End If



End Sub

---------------

Excel tip:

Return to the active cell after scrolling

When I scroll a long way down the screen from a selected cell, I can return to that cell with the Ctrl+Back Space shortcut. The active cell now appears in roughly the middle of the screen.

Shift+Back Space does something similar. Scroll down from the active cell and Shift+Back Space returns me to it and puts the active cell at the top of the screen; scroll up from the active cell and Shift+Back Space returns me to it and puts the active cell at the bottom of the screen.

Note also, that while Ctrl+Back Space will return me back to a selected range, Shift+Back Space only ever returns me to the active cell, which is normally at the top left-hand corner of any selected range.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.