![]() |
|
|
|
#1
|
||||
|
||||
|
Your whole post looks as if it's a reply to a post somewhere else. Very confusing. To merge all of column A, you don't need to know about page breaks. You could use code like: Code:
Sub Demo()
With ActiveSheet
.Range("A1", Range("A" & .Cells.SpecialCells(xlCellTypeLastCell).Row)).Merge
End With
End Sub
Code:
Sub Demo()
Dim h As Long, i As Long, j As Long, k As Long
With ActiveSheet
h = .Cells.SpecialCells(xlCellTypeLastCell).Column
j = 1
For i = 1 To .HPageBreaks.Count
If i > 1 Then j = .HPageBreaks(i - 1).Location.Row
k = .HPageBreaks(i).Location.Row - 1
MsgBox .Range("A" & k, .Cells(k, h).Address).Address _
& vbCr & .Range("A" & j, "A" & k).Address
'.Range("A" & j, .Cells(j, h).Address).Merge
'.Range("A" & j, "A" & k).Merge
Next
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Merge Cells Row By Row in a Table
|
KD999 | Word VBA | 4 | 02-20-2012 08:51 PM |
Concatenate/merge contents of multiple cells
|
PSYloco | Excel | 2 | 05-14-2011 03:46 PM |
| Count range cells eliminating merge cells | danbenedek | Excel | 0 | 06-15-2010 12:40 AM |
| How to merge matching cells vertically? | Odiseh | Excel | 1 | 01-02-2010 02:41 PM |
| Nested if formulat to merge cells | cristi22 | Excel | 0 | 10-23-2006 08:28 AM |