Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Select Merged Cells and Unmerge Spread Merge Data To All Cells

This is the start:

Sub findmerged()
Dim c
For Each c In ActiveSheet.UsedRange
If c.MergeCells Then
MsgBox c.Address & " is merged"
End If
Next
End Sub

Sub Unmerge()
Dim rng As Range, rngtot As Range, rngval As Variant
Dim strtrow As Long, endrow As Long, col As Long

strtrow = Selection.Row
col = Selection.Column
endrow = Application.WorksheetFunction.Min(Selection.End(xl Down).Row - 1,
Cells(65536, col).End(xlUp).Row + 1)
rngval = Selection.Value

Set rngtot = Range(Cells(strtrow, col), Cells(endrow, col))

ActiveCell.Unmerge
For Each rng In rngtot
rng.Value = rngval
Next rng

End Sub

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Select Merged Cells and Unmerge Spread Merge Data To All Cells

What is the problem you are having? Do you have a question? Indicate where
the error is and what type of error?


--
Cheers,
Ryan


"rtwiss via OfficeKB.com" wrote:

This is the start:

Sub findmerged()
Dim c
For Each c In ActiveSheet.UsedRange
If c.MergeCells Then
MsgBox c.Address & " is merged"
End If
Next
End Sub

Sub Unmerge()
Dim rng As Range, rngtot As Range, rngval As Variant
Dim strtrow As Long, endrow As Long, col As Long

strtrow = Selection.Row
col = Selection.Column
endrow = Application.WorksheetFunction.Min(Selection.End(xl Down).Row - 1,
Cells(65536, col).End(xlUp).Row + 1)
rngval = Selection.Value

Set rngtot = Range(Cells(strtrow, col), Cells(endrow, col))

ActiveCell.Unmerge
For Each rng In rngtot
rng.Value = rngval
Next rng

End Sub

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Select Merged Cells and Unmerge Spread Merge Data To All Cells

trying to select all merged cells on sheet then unmerge each merge cell and
spread merge data to all cells in each merged cell. You follow?

RyanH wrote:
What is the problem you are having? Do you have a question? Indicate where
the error is and what type of error?

This is the start:

[quoted text clipped - 25 lines]

End Sub


--
Message posted via http://www.officekb.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sort spreadsheet, "merged cells" comes up. Find cells? Unmerge ? lowell Excel Discussion (Misc queries) 1 August 20th 06 09:10 AM
Spreadsheet with merged cells - how can I unmerge the cell and re. Dotgale2 Excel Programming 1 February 2nd 05 01:57 AM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM
How can I unmerge the merged cells in a Excel sheet quickly? Tomorrow Excel Programming 9 October 28th 04 05:00 PM
Can't unmerge merged cells programatically James[_29_] Excel Programming 1 September 14th 04 12:59 AM


All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"