Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Unmerge cells and fill duplicate data

I have a report that contains merged cells. I need to get rid of the merged
cells and then have the data from the first row repeated in the blank rows.
I found a macro to umerge all the cells (Cells.MergeCells = False) so far so
good! But now I need to repeat the data. I have two columns in the sheet
that will need to be unmerged and have the data repeated.

The existing workbook looks like this, with the cells for W, X, Y, and Z
merged so they span one or more rows, it varies:

X Y 1 2 3
4 5 6
Z W 7 8 9
1 2 3

I need it like this, so I can successfully filter:

X Y 1 2 3
X Y 4 5 6
Z W 7 8 9
Z W 1 2 3

TIA for any help!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Unmerge cells and fill duplicate data

Try something like this


Option Explicit

Sub Test()

Dim r As Excel.Range
Dim r1 As Excel.Range
Dim myR As Excel.Range

For Each r In ActiveSheet.UsedRange
Debug.Print r.Address, r.Count
If r.MergeArea.Count 1 Then
Set myR = r.MergeArea
r.UnMerge
For Each r1 In myR
r1.Value2 = myR.Value2
Next r1
End If
Next r

End Sub

HTH,
Barb Reinhardt


"Dawn" wrote:

I have a report that contains merged cells. I need to get rid of the merged
cells and then have the data from the first row repeated in the blank rows.
I found a macro to umerge all the cells (Cells.MergeCells = False) so far so
good! But now I need to repeat the data. I have two columns in the sheet
that will need to be unmerged and have the data repeated.

The existing workbook looks like this, with the cells for W, X, Y, and Z
merged so they span one or more rows, it varies:

X Y 1 2 3
4 5 6
Z W 7 8 9
1 2 3

I need it like this, so I can successfully filter:

X Y 1 2 3
X Y 4 5 6
Z W 7 8 9
Z W 1 2 3

TIA for any help!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Unmerge cells and fill duplicate data

Is the 4, 5, & 6 under the 1, 2, & 3? If so, and if you want to fill the
blanks below x & Y, look at this:
http://www.contextures.com/xlDataEntry02.html

If that doesn't work, please post back with a little more info.

Thanks,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Dawn" wrote:

I have a report that contains merged cells. I need to get rid of the merged
cells and then have the data from the first row repeated in the blank rows.
I found a macro to umerge all the cells (Cells.MergeCells = False) so far so
good! But now I need to repeat the data. I have two columns in the sheet
that will need to be unmerged and have the data repeated.

The existing workbook looks like this, with the cells for W, X, Y, and Z
merged so they span one or more rows, it varies:

X Y 1 2 3
4 5 6
Z W 7 8 9
1 2 3

I need it like this, so I can successfully filter:

X Y 1 2 3
X Y 4 5 6
Z W 7 8 9
Z W 1 2 3

TIA for any help!



  #4   Report Post  
Posted to microsoft.public.excel.programming
GES GES is offline
external usenet poster
 
Posts: 1
Default Unmerge cells and fill duplicate data

This is AWESOME! Thank you so much for saving me hours of time! I've always
wondered how to do this.
GES

"ryguy7272" wrote:

Is the 4, 5, & 6 under the 1, 2, & 3? If so, and if you want to fill the
blanks below x & Y, look at this:
http://www.contextures.com/xlDataEntry02.html

If that doesn't work, please post back with a little more info.

Thanks,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Dawn" wrote:

I have a report that contains merged cells. I need to get rid of the merged
cells and then have the data from the first row repeated in the blank rows.
I found a macro to umerge all the cells (Cells.MergeCells = False) so far so
good! But now I need to repeat the data. I have two columns in the sheet
that will need to be unmerged and have the data repeated.

The existing workbook looks like this, with the cells for W, X, Y, and Z
merged so they span one or more rows, it varies:

X Y 1 2 3
4 5 6
Z W 7 8 9
1 2 3

I need it like this, so I can successfully filter:

X Y 1 2 3
X Y 4 5 6
Z W 7 8 9
Z W 1 2 3

TIA for any help!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unmerge cells and fill duplicate data

Add another column (B) and then add this function to fill in everything until another entry for the merged cell in col A:
=IF(A2=0,B1,A2).

This assumes you have one header.


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Unmerge cells and fill duplicate data

On Sunday, January 13, 2013 11:28:20 PM UTC+2, wrote:
Add another column (B) and then add this function to fill in everything until another entry for the merged cell in col A:

=IF(A2=0,B1,A2).



This assumes you have one header.


For two or more rows, this will not work.
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
Select Merged Cells and Unmerge Spread Merge Data To All Cells rtwiss via OfficeKB.com Excel Programming 2 October 2nd 08 04:24 AM
MACRO - Unmerge cells and delete blank columns, leaving data colum Alex Sander Excel Programming 5 August 8th 06 12:10 PM
Unmerge cells and place contents of first cell in all cells Amanda Excel Programming 1 September 12th 05 10:52 PM
How do you unmerge cells? Pank Mehta Excel Discussion (Misc queries) 1 February 1st 05 02:29 PM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM


All times are GMT +1. The time now is 09:55 PM.

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"