Shatnerfreude
New Member
- Joined
- Feb 26, 2015
- Messages
- 12
Hello,
This is my second posting for this problem... I apologize for "spamming".
I would please like a VB code for making the first duplicate black font in each group of duplicates in a column. I will set the rest of the column to white font as default. (See Example)
This is to avoid merging these duplicate cells, and could be very useful for others, as well. I currently have a code for automatically merging and top justifying sets of duplicates down the column (see below). Maybe it can be used as a template/starting place for What I need?
I have tried many combinations of conditional formatting, but nothing seems to work (although I have learned how to format the bottom duplicate).
Example:
Start with
a
a
a
a
b
b
b
c
c
c
c
Becomes
a
a
a
a
b
b
b
c
c
c
c
(Pretend the faded letters are invisible as white font)
Here is the code which automatically merges and top justifies groups of duplicates. I want to emulate the results of this without merging cells.
Sub MergeDupes()
Dim r As Range, c As Range
Dim i As Long, j As Long
Set r = Range("A1", Cells(Rows.Count, "A").End(xlUp))
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 1 To r.Count
Set c = r(i)
j = 0
Do Until c <> c.Offset(rowoffset:=1)
Set c = c(2)
j = j + 1
Loop
With Range(r(i), c)
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
End With
i = i + j
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
THANK YOU!!!
This is my second posting for this problem... I apologize for "spamming".
I would please like a VB code for making the first duplicate black font in each group of duplicates in a column. I will set the rest of the column to white font as default. (See Example)
This is to avoid merging these duplicate cells, and could be very useful for others, as well. I currently have a code for automatically merging and top justifying sets of duplicates down the column (see below). Maybe it can be used as a template/starting place for What I need?
I have tried many combinations of conditional formatting, but nothing seems to work (although I have learned how to format the bottom duplicate).
Example:
Start with
a
a
a
a
b
b
b
c
c
c
c
Becomes
a
a
a
a
b
b
b
c
c
c
c
(Pretend the faded letters are invisible as white font)
Here is the code which automatically merges and top justifies groups of duplicates. I want to emulate the results of this without merging cells.
Sub MergeDupes()
Dim r As Range, c As Range
Dim i As Long, j As Long
Set r = Range("A1", Cells(Rows.Count, "A").End(xlUp))
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 1 To r.Count
Set c = r(i)
j = 0
Do Until c <> c.Offset(rowoffset:=1)
Set c = c(2)
j = j + 1
Loop
With Range(r(i), c)
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
End With
i = i + j
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
THANK YOU!!!