ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to Merge Cells (https://www.excelbanter.com/excel-programming/342529-vba-merge-cells.html)

Darin Kramer

VBA to Merge Cells
 


Hi there,

Is there VBA that can merge cells on a row by row basis over a specified
column?

Eg a1,b1,c1 need to be merged
a2,c2,b2, need to be merged
etc etc to say line 200

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***

Stefi

VBA to Merge Cells
 
Sub Yourmerge()
For i = 1 To 200
Range("A" & i & ":C" & i).MergeCells = True
Next i
End Sub

Stefi


"Darin Kramer" wrote:



Hi there,

Is there VBA that can merge cells on a row by row basis over a specified
column?

Eg a1,b1,c1 need to be merged
a2,c2,b2, need to be merged
etc etc to say line 200

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***


Darin Kramer

VBA to Merge Cells
 


Thank you SO SO MUCH!!!! works perfectly

*** Sent via Developersdex http://www.developersdex.com ***

Dave Peterson

VBA to Merge Cells
 
One mo

Option Explicit
Sub testme()
Application.DisplayAlerts = False
With ActiveSheet.Range("a1:B200")
.Merge Across:=True
End With
Application.DisplayAlerts = True
End Sub

You also have another response at your other post (non-VBA).

Darin Kramer wrote:

Hi there,

Is there VBA that can merge cells on a row by row basis over a specified
column?

Eg a1,b1,c1 need to be merged
a2,c2,b2, need to be merged
etc etc to say line 200

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson


All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com