Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My apologies. I made some changs to the program after initial testing and
then did not look at the results carefully enough after making those changes. Replace it with the following code. Sub RemoveSuperfluous() Dim rngUnit As Range Dim c As Range With Sheets("Sheet1") Set rngUnit = .Range(.Cells(2, "A"), _ .Cells(.Rows.Count, "A").End(xlUp)) End With For Each c In rngUnit If c = c.Offset(1, 0) Then 'Set interior color for both Unit# and Team Leader Range(c.Offset(1, 0), c.Offset(1, 1)).Interior.ColorIndex = 6 End If Next c 'Stop 'Stop here if you want to test what is being cleared For Each c In rngUnit If c.Interior.ColorIndex = 6 Then 'Clear contents only for both Unit# and Team Leader Range(c, c.Offset(0, 1)).ClearContents 'Remove ColorIndex for both Unit# and Team Leader Range(c, c.Offset(0, 1)).Interior.ColorIndex = xlNone End If Next c End Sub -- Regards, OssieMac |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
merging cells and eliminating spaces for empty cells | Excel Discussion (Misc queries) | |||
Formula for merging cells/re sizing cells | Excel Discussion (Misc queries) | |||
merging cells together but keeping all data from the cells | Excel Discussion (Misc queries) | |||
Selecting and merging range within numerous rows | Excel Programming | |||
Merging Cells but have each cell counted in the range of merged c. | Excel Worksheet Functions |