S
Steve
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:
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.
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.