Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

Merged cells

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cowtoon - 31 Jul 2006 19:42 GMT
A friend of mine is trying to do a sort, but is getting the message that it
can't sort merged cells.
He's not aware of any merged cells.  Is there an easy way to detect a merged
cell?
Thanks.
Harlan Grove - 31 Jul 2006 20:07 GMT
Cowtoon wrote...
>A friend of mine is trying to do a sort, but is getting the message that it
>can't sort merged cells.
>He's not aware of any merged cells.  Is there an easy way to detect a merged
>cell?

If there aren't supposed to be any merged cells in your friend's sort
range, have him select the sort range, press [Ctrl]+[F1] to bring up
the Format Cells dialog, select the Alignment tab, and make sure the
Merge Cells checkbox is empty.
Cowtoon - 31 Jul 2006 20:18 GMT
Thank you.  I've forwarded this to my friend.  If he can't figure it out ...
I probably can (will get him to send me the file).  It might require several
selections to narrow the field.
Thanks again.

Cowtoon wrote...
>A friend of mine is trying to do a sort, but is getting the message that it
>can't sort merged cells.
>He's not aware of any merged cells.  Is there an easy way to detect a merged
>cell?

If there aren't supposed to be any merged cells in your friend's sort
range, have him select the sort range, press [Ctrl]+[F1] to bring up
the Format Cells dialog, select the Alignment tab, and make sure the
Merge Cells checkbox is empty.
Dave Peterson - 31 Jul 2006 21:04 GMT
A small typo...

Tell your friend to use ctrl-1 (one, not F1).

Or just Format|Cells|Alignment tab from the worksheet menu tab.

> Thank you.  I've forwarded this to my friend.  If he can't figure it out ...
> I probably can (will get him to send me the file).  It might require several
[quoted text clipped - 12 lines]
> the Format Cells dialog, select the Alignment tab, and make sure the
> Merge Cells checkbox is empty.

Signature

Dave Peterson

Tom Hutchins - 31 Jul 2006 20:16 GMT
The following macro will list (via MsgBox) every merged cell on the active
sheet.

Sub ListMerged()
   Dim Rng As Range, LastRng As String
   LastRng$ = FindLastCell(ActiveSheet)
   If LastRng$ = "ERROR" Then Exit Sub
   ActiveSheet.Range("A1:" & LastRng$).Select
   For Each Rng In Selection
       If Rng.MergeCells Then
           MsgBox Rng.Address & " is a merged cell"
       End If
   Next Rng
End Sub

Function FindLastCell(Wksht As Worksheet) As String
'Returns address of last cell used (highest row & col) on specified sheet
   Dim LastRow As Long
   Dim LastCol As Integer
   On Error GoTo FLCerr1
   With Wksht
       LastRow = 0
       LastCol = 0
       LastRow& = _
           .Cells.Find("*", after:=.Cells(1), _
           LookIn:=xlFormulas, LookAt:=xlWhole, _
           SearchDirection:=xlPrevious, _
           SearchOrder:=xlByRows).Row
       LastCol% = _
           .Cells.Find("*", after:=.Cells(1), _
           LookIn:=xlFormulas, LookAt:=xlWhole, _
           SearchDirection:=xlPrevious, _
           SearchOrder:=xlByColumns).Column
   End With
   FindLastCell$ = Cells(LastRow&, LastCol%).AddressLocal
   Exit Function
FLCerr1:
   FindLastCell$ = "ERROR"
End Function

Copy & paste the code above into a VBA module or the ThisWorkbook module of
the workbook. Go to the the sheet in question. Click any cell on it to make
sure it is the active sheet. Select Tools >> Macro >> Macros. Select
ListMerged and click OK.
Write down the cell addresses listed.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

> A friend of mine is trying to do a sort, but is getting the message that it
> can't sort merged cells.
> He's not aware of any merged cells.  Is there an easy way to detect a merged
> cell?
> Thanks.
Cowtoon - 31 Jul 2006 21:00 GMT
Thanks Tom, it might just be what we need.
Diana

The following macro will list (via MsgBox) every merged cell on the active
sheet.

Sub ListMerged()
   Dim Rng As Range, LastRng As String
   LastRng$ = FindLastCell(ActiveSheet)
   If LastRng$ = "ERROR" Then Exit Sub
   ActiveSheet.Range("A1:" & LastRng$).Select
   For Each Rng In Selection
       If Rng.MergeCells Then
           MsgBox Rng.Address & " is a merged cell"
       End If
   Next Rng
End Sub

Function FindLastCell(Wksht As Worksheet) As String
'Returns address of last cell used (highest row & col) on specified sheet
   Dim LastRow As Long
   Dim LastCol As Integer
   On Error GoTo FLCerr1
   With Wksht
       LastRow = 0
       LastCol = 0
       LastRow& = _
           .Cells.Find("*", after:=.Cells(1), _
           LookIn:=xlFormulas, LookAt:=xlWhole, _
           SearchDirection:=xlPrevious, _
           SearchOrder:=xlByRows).Row
       LastCol% = _
           .Cells.Find("*", after:=.Cells(1), _
           LookIn:=xlFormulas, LookAt:=xlWhole, _
           SearchDirection:=xlPrevious, _
           SearchOrder:=xlByColumns).Column
   End With
   FindLastCell$ = Cells(LastRow&, LastCol%).AddressLocal
   Exit Function
FLCerr1:
   FindLastCell$ = "ERROR"
End Function

Copy & paste the code above into a VBA module or the ThisWorkbook module of
the workbook. Go to the the sheet in question. Click any cell on it to make
sure it is the active sheet. Select Tools >> Macro >> Macros. Select
ListMerged and click OK.
Write down the cell addresses listed.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

"Cowtoon" wrote:

> A friend of mine is trying to do a sort, but is getting the message that it
> can't sort merged cells.
> He's not aware of any merged cells.  Is there an easy way to detect a merged
> cell?
> Thanks.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.