Merge vertically ?

B

bbelly

The button "merge across" allows you to pick a group of cells, and
merges them along rows.

I need to pick a group of cells and have them merge in columns.

Perhaps someone has seen such a need, and has a code?

Thanks
 
B

bbelly

Toppers said:
It will merge columns too!

:

Perhaps you misunderstand my request?

Given a group of cells A1 - D4, applying 'merge across' to this group
creates four merged cells ...

_________________
| A1 B1 C1 D1 |
|________________|
| A2 B2 C2 D2 |
|________________|
| A3 B3 C3 D3 |
|________________|
| A4 B4 C4 D4 |
|________________|

I want to select this group, apply 'merge up&down'( 'merge vertical),
and get four cells merged thus ...

____________________
| A1 | A2 | A3 | A4 |
| | | | |
| B1 | B2 | B3 | B4 |
| | | | |
| C1 | C2 | C3 | C4 |
| | | | |
| D1 | D2 | D3 | D4 |
|____|____|____|____|

Hope that illustrates better.
 
G

Gord Dibben

Use the "merge cells" button, not the "merge across" button.

Select the cells first then click on the button to merge vertically.

Then be prepared for the usual problems with merged cells.


Gord Dibben MS Excel MVP
 
D

Dave Peterson

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCol As Range
Set myRng = Selection
For Each myCol In myRng.Columns
myCol.Merge
Next myCol
End Sub

Select your range first, then run the macro.
 
G

Gord Dibben

What you want is "transpose"

Select A1:D4 and copy.

Select a cell out of the range and Paste Special>Transpose>OK>Esc.

Then do the merge across.


Gord Dibben MS Excel MVP
 
M

Mike Rogers

bbelly

Have you tried Toppers solution? Either we do not understand what you mean
by the "Merge Across" button or you have something that I don't. What
version of excel are you running? On xl2k I have "merge & center" button that
works both ways. Merges rows within a column and colums withing a row.

Mike Rogers
 
B

bbelly

Dave said:
Option Explicit
Sub testme()
Dim myRng As Range
Dim myCol As Range
Set myRng = Selection
For Each myCol In myRng.Columns
myCol.Merge
Next myCol
End Sub

Select your range first, then run the macro.

Thanks ...

This is the answer to the question I was asking. I'll try it tomorrow.

Specifically, to pick a range, and have 'merge vertically' applied to
the lot, instead of picking two cells one on another, applying merge,
and repeating about 15 times for each affected row set.

Again, thank you
 
B

bbelly

bbelly said:
Thanks ...

This is the answer to the question I was asking. I'll try it tomorrow.

Specifically, to pick a range, and have 'merge vertically' applied to
the lot, instead of picking two cells one on another, applying merge,
and repeating about 15 times for each affected row set.

Again, thank you

Please be advised that I applied this code to a button, works like a charm !

Thank You
 
Top