![]() |
Merge cells with formula or macro?
I would like to merge cells in column A when the adjacent vertical cells are
the same. For example: Col A Row1 CX457 Row2 AG925 Row3 AG925 Row4 AG925 Row5 RB639 Row6 RB639 In this case A2, A3 & A4 would be merged, A5 & A6 would be merged. Is there a way to do this automatically? Thanks, Joe M. |
Merge cells with formula or macro?
I'd recommend against merging cells. Why not use a conditional format and if
the cells match, have one of them change to a white font? "Joe M." wrote: I would like to merge cells in column A when the adjacent vertical cells are the same. For example: Col A Row1 CX457 Row2 AG925 Row3 AG925 Row4 AG925 Row5 RB639 Row6 RB639 In this case A2, A3 & A4 would be merged, A5 & A6 would be merged. Is there a way to do this automatically? Thanks, Joe M. |
Merge cells with formula or macro?
Merged? As in concatenated (added together to read RB639 RB639 in a
single cell)? Or do you want to show only a single occurence if the entry occurs multiple times? |
Merge cells with formula or macro?
what do you mean by merging cells?
merging can mean anything from summing up values. Deleting duplicates, to formatting several cells to appear as one cell. "Joe M." wrote: I would like to merge cells in column A when the adjacent vertical cells are the same. For example: Col A Row1 CX457 Row2 AG925 Row3 AG925 Row4 AG925 Row5 RB639 Row6 RB639 In this case A2, A3 & A4 would be merged, A5 & A6 would be merged. Is there a way to do this automatically? Thanks, Joe M. |
Merge cells with formula or macro?
Sorry for not being clear. In this case, merge as to format several cells to
appear as one cell. "bj" wrote: what do you mean by merging cells? merging can mean anything from summing up values. Deleting duplicates, to formatting several cells to appear as one cell. "Joe M." wrote: I would like to merge cells in column A when the adjacent vertical cells are the same. For example: Col A Row1 CX457 Row2 AG925 Row3 AG925 Row4 AG925 Row5 RB639 Row6 RB639 In this case A2, A3 & A4 would be merged, A5 & A6 would be merged. Is there a way to do this automatically? Thanks, Joe M. |
Merge cells with formula or macro?
I have had a lotr of trouble with merged cells over the years, but a brute
force macro to do what you want would be Sub test() rt = 1 For r = 2 To 50000 If Cells(r, 1) = "" Then GoTo 99 If Cells(r - 1, 1) < Cells(r, 1) Then rt = r: GoTo 99 If Cells(r - 1, 1) = Cells(r + 1, 1) Then GoTo 99 If Cells(r - 1) = Cells(r, 1) Then Range(Cells(rt, 1), Cells(r, 1)).Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With End If 99 Next r change the formating of the merged cells as you would like them to appear End Sub "Joe M." wrote: Sorry for not being clear. In this case, merge as to format several cells to appear as one cell. "bj" wrote: what do you mean by merging cells? merging can mean anything from summing up values. Deleting duplicates, to formatting several cells to appear as one cell. "Joe M." wrote: I would like to merge cells in column A when the adjacent vertical cells are the same. For example: Col A Row1 CX457 Row2 AG925 Row3 AG925 Row4 AG925 Row5 RB639 Row6 RB639 In this case A2, A3 & A4 would be merged, A5 & A6 would be merged. Is there a way to do this automatically? Thanks, Joe M. |
All times are GMT +1. The time now is 02:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com