Merge multiple cells

vicedo

Active Member
Joined
Jan 9, 2015
Messages
401
Guys please i have a worksheet which was converted from a pdf document and i need to merge these cells together. Below is a sample of what the sheet looks like.

Doing this manually would be time consuming since i have too many rows to work on.

I need a VBA code to look through range A, if is blank, merge everything under the Ref. 1 column up.

e.g "Re-allocation of bi-monthly revenue"

Post DateDue DateTypeTransRef.1DetailsContra Acct
11/10/1211/10/12PU157572A/P InvoiceSMULTI
11/10/1211/10/12PC1576Re-alloA/R Invoice -C- Listings156510-000
cation of
bi
monthly
revenue
08/01/1308/01/13IN2198717A/R Invoice -C- ListingsC- Listings
11/10/1211/10/12JE1405Re-allocation ofA/P Invoice645070-0000
Bi-monthly income

<tbody>
</tbody>
















Thanks in advance.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG08Jun36
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, R [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range("A1").CurrentRegion.Columns(1).SpecialCells(xlCellTypeBlanks)
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng.Areas
    [COLOR="Navy"]Set[/COLOR] R = Dn.Offset(-1, 4).Resize(Dn.Count + 1)
    R(1).Value = Join(Application.Transpose(R.Value))
Application.DisplayAlerts = False
    [COLOR="Navy"]With[/COLOR] R
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = True
        .MergeCells = True
    [COLOR="Navy"]End[/COLOR] With
Application.DisplayAlerts = True
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

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