ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Number Sequence (https://www.excelbanter.com/excel-programming/329573-number-sequence.html)

smandula

Number Sequence
 
I would like to obtain numbers that are in sequence in a six column ranges.
Selecting across Columns only not rows.
Such as, A1.. F2
A B C D E F
1 1 12 33 9 10 44
2 0 3 4 13 94 15

9 & 10 are in sequence across columns
So are 3 & 4 in sequence.
Once the sequence has been identified, 9 & 10; 3 & 4,
they would be highlited by a color such as grey,
Any suggestions would be appreciated.

With Thanks in advance




Gixxer_J_97[_2_]

Number Sequence
 
this worked for me:

Dim x As Range
With Sheets("Sheet1")
Set x = .Range(.Range("A1"), .Range("F2"))
End With

For Each c In x
If c.Value = (c.Offset(0, 1).Value - 1) Then
Range(c, c.Offset(0, 1)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
End If
Next


"smandula" wrote:

I would like to obtain numbers that are in sequence in a six column ranges.
Selecting across Columns only not rows.
Such as, A1.. F2
A B C D E F
1 1 12 33 9 10 44
2 0 3 4 13 94 15

9 & 10 are in sequence across columns
So are 3 & 4 in sequence.
Once the sequence has been identified, 9 & 10; 3 & 4,
they would be highlited by a color such as grey,
Any suggestions would be appreciated.

With Thanks in advance





Gary Brown[_5_]

Number Sequence
 
Using Conditional Formatting and your example...
Highlight Rows 1 and 2.
FORMAT / CONDITIONAL FORMATTING...

Condition 1:
Formula is
=A1=IV1+1
Select the format desired

ADD

Condition 2:
Formula is
=A1=B1-1
Select the format desired


HTH,
--
Gary Brown



"smandula" wrote:

I would like to obtain numbers that are in sequence in a six column ranges.
Selecting across Columns only not rows.
Such as, A1.. F2
A B C D E F
1 1 12 33 9 10 44
2 0 3 4 13 94 15

9 & 10 are in sequence across columns
So are 3 & 4 in sequence.
Once the sequence has been identified, 9 & 10; 3 & 4,
they would be highlited by a color such as grey,
Any suggestions would be appreciated.

With Thanks in advance





JE McGimpsey

Number Sequence
 
One way:

Select Column A. Enter the following CF:

CF1: Formula is =B1-A1=1
Format1: Grey


Select Column F. Enter this CF:

CF1: Formula is =F1-E1=1
Format1 Grey

Select columns B:E, apply these CF:

CF1: Formula is =C1-B1=1
Format1: Grey
CF2: Formula Is =D1-C1=1
Format2: Grey





In article ,
"smandula" wrote:

I would like to obtain numbers that are in sequence in a six column ranges.
Selecting across Columns only not rows.
Such as, A1.. F2
A B C D E F
1 1 12 33 9 10 44
2 0 3 4 13 94 15

9 & 10 are in sequence across columns
So are 3 & 4 in sequence.
Once the sequence has been identified, 9 & 10; 3 & 4,
they would be highlited by a color such as grey,
Any suggestions would be appreciated.

With Thanks in advance


smandula

Number Sequence
 
Thanks very much for the solutions.





All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com