Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 774
- Office Version
- 365
- 2019
- Platform
- Windows
Good day,
I have a VBA which basically works, but I need a code that works on Merging Cells on a sequence. If you look at the VBA you can see the pattern. E3:E4, E5:E6 etc. Because I do not know how many cells that can be merged. I need to have it based on the last cell in Column C that has a Value? If possible I need the same thing for Column P otherwise I will create a separate Macro. In both cases it will begin on Row3. Each merge will only envolve two rows.
Thank you so very much.
I have a VBA which basically works, but I need a code that works on Merging Cells on a sequence. If you look at the VBA you can see the pattern. E3:E4, E5:E6 etc. Because I do not know how many cells that can be merged. I need to have it based on the last cell in Column C that has a Value? If possible I need the same thing for Column P otherwise I will create a separate Macro. In both cases it will begin on Row3. Each merge will only envolve two rows.
Thank you so very much.
VBA Code:
Sub Merge_Column_E()
With Range("E3:E4, E5:E6, E7:E8, E9:E10, E11:E12, E13:E14, E15:E16, E17:E18, E19:E20, E21:E22, E23:E24," & _
"E25:E26, E27:E28, E29:E30, E31:E32, E33:E34, E35:E36, E37:E38, E39:E40, E41:E42, E43:E44, E45:E46, E47:E48, E49:E50," & _
"E51:E52, E53:E54, E55:E56, E57:E58,E59:E60")
.Merge
.HorizontalAlignment = xlEenter
.VerticalAlignment = xlEenter
End With
End Sub