Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Morning all.
Let's see.... I've modified an existing macro to test for borders, and to merge the selected cells. My If test appears to work ok, but my core operation doesn't. My code is: Code:
For Each rcell2 In Selection If rcell2.Borders(xlEdgeBottom).LineStyle = xlSolid Then ActiveSheet.Range(rcell1, rcell2).Select With Selection .Merge .VerticalAlignment = xlCenter .HorizontalAlignment = xlCenter End With 'Set rcell1 = Nothing 'Set rcell2 = Nothing ActiveCell.Offset(1, 0).Select 'end if End If Next rcell2 I have 3 if tests outside of the above. My intention was to iterate through a series of rows, looking for a border on top, and a border on the bottom, after an undefined number of rows. Once it finds the rows, I want to select them, and merge them. However, in the case of my present macro, it merges, iterates through a second set of rows, and selects the first set, and then selects, and merges the second set with the first set. This does not work. My thinking at this point is that the rcell1 variable has the first row's location still stored in its buffer, and if this indeed the case, I need the rcell1 buffer emptied, to start with a new row location. The problem is-- I'm not clear on how this is done. Anyone know how to do this? Thank you. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Automatically merge mulitiple cells to one cells | Excel Worksheet Functions | |||
Select Merged Cells and Unmerge Spread Merge Data To All Cells | Excel Programming | |||
how do I merge cells into one then delete the original cells? | Excel Worksheet Functions | |||
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? | Excel Programming | |||
How do I merge cells in Excel, like just 2 cells to make one big . | Excel Discussion (Misc queries) |