![]() |
Change font if item above is not hidden
I have a macro that hides duplicate entries in a row. I have the word
'Science" in range A3:A36. Range A37:A106 has the word "Economics". Row A9 is hidden. When I run the macro below, A3 has Science and A37 has Economics and the rest of the items are hidden (white font). On the off-chance that rows 3 or 37 are hidden (before the macro is run) how can I make sure that A4 or A38 can be viewed? That is, if the first item is hidden don't change the font color to white on the second so that someone viewing the spreadsheet will know the subject area of the book list. Thanks for your help -- and I hope I have explained the issue intelligibly. 'Macro changes font color on duplicates 'regardless of whether the first row is hidden 'If value of cell above is equal to current cell, 'change to white Dim DataRng As Range Dim CellRng As Range Set DataRng = Range(ActiveCell, ActiveCell.Resize(Selection.Rows.Count + 3000)) For Each CellRng In DataRng If CellRng.Offset(-1, 0).Value = CellRng.Value Then CellRng.Font.ColorIndex = 2 End If Next |
All times are GMT +1. The time now is 07:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com