Unmerging and copying data in each cell

ritzkalz49

New Member
Joined
Aug 5, 2010
Messages
3
Hi, I am new to this forum and seeking help.

I am using this code to unmerge the data and copying in each cell, but it is only working in column A. I need to the same in column B & C, it doesn't work even I change the range in the code. Please help

Sub unmergeA()
Range("A1:A" & Cells(Rows.Count, "D").End(xlUp).Row).MergeCells = False
For x = 2 To Cells(Rows.Count, "D").End(xlUp).Row + 0
If Cells(x, 1) = "" Then Cells(x, 1) = Cells(x - 1, 1)
Next x
End Sub

For column B I had tried this code

Sub unmergeB()
Range("B1:B" & Cells(Rows.Count, "D").End(xlUp).Row).MergeCells = False
For x = 2 To Cells(Rows.Count, "D").End(xlUp).Row + 0
If Cells(x, 1) = "" Then Cells(x, 1) = Cells(x - 1, 1)
Next x
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Try

Rich (BB code):
Sub unmergeB()
Range("B1:B" & Cells(Rows.Count, "D").End(xlUp).Row).MergeCells = False
For X = 2 To Cells(Rows.Count, "D").End(xlUp).Row + 0
    If Cells(X, 2) = "" Then Cells(X, 2) = Cells(X - 1, 2)
Next X
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top