Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight consecutive series of four numbers vba
I would like to highlight all four consecutive sequential
numbers in range of C2:V25 1 2 3 4 11 23 36 42 25 26 33 34 35 36 40 45 1 2 3 4 and 33 34 35 36 will be highlighted only any color. With Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight consecutive series of four numbers vba
See if this will do it. This assumes that the sequence is horizontal in
rows rather than in columns. Sub fh() Dim c As Range x = 1 For Each c In Range("C2:V25") If c.Offset(, 1).Value - c.Value = 1 Then If x = 1 Then rng = c.Address End If x = x + 1 If x = 4 Then Range(rng, c.Offset(, 1)).Interior.ColorIndex = 6 x = 1 End If Else x = 1 End If Next End Sub "smandula" wrote in message ... I would like to highlight all four consecutive sequential numbers in range of C2:V25 1 2 3 4 11 23 36 42 25 26 33 34 35 36 40 45 1 2 3 4 and 33 34 35 36 will be highlighted only any color. With Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight consecutive series of four numbers vba
Hi,
Will any of the ranges overlap e.g. 6 (or more) consecutive numbers 123456 will any consecutive numbers wrap around 2 rows i.e. the last 2 rows on 1 line and the first 2 on the next be a consecutive series? Mike "smandula" wrote: I would like to highlight all four consecutive sequential numbers in range of C2:V25 1 2 3 4 11 23 36 42 25 26 33 34 35 36 40 45 1 2 3 4 and 33 34 35 36 will be highlighted only any color. With Thanks . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight consecutive series of four numbers vba
Thank you very much,
I really appreciate your solution. Again, with Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
highlight consecutive series of four numbers vba
Thanks for replying.
There will be no wrap, just straight 4 consecutive numbers. The solution provided works extremely well! I tried individual if statements, but the colors and numbers splattered all over the given range. This solution cuts only the required 4 consecutive cells Thanks to everyone providing and reading this post |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Highlight Duplicate Rows (In Series) | Excel Programming | |||
Calculating largest gap in a series of consecutive numbers | Excel Worksheet Functions | |||
Consecutive Numbers | Excel Discussion (Misc queries) | |||
consecutive numbers | Excel Programming | |||
consecutive numbers | Excel Worksheet Functions |