ExcelBanter

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

[email protected]

Merge Cells in VBA
 
Is there a way to merge cells in VBA?


davegb

Merge Cells in VBA
 

wrote:
Is there a way to merge cells in VBA?


Selection.Merge

The easiest way to figure out something like this is to just record a
macro while you do it, like merging, then look at the macro. Works in
many cases. In some, a recorded macro does it differently than you'd
normally code it, but it's a start.


Ron de Bruin

Merge Cells in VBA
 
Do you want this ??

Sub test()
Dim cell As Range
Dim str As String
For Each cell In Range("A1:A10")
str = str & cell.Value
Next cell
MsgBox str
End Sub


--
Regards Ron De Bruin
http://www.rondebruin.nl



wrote in message oups.com...
Is there a way to merge cells in VBA?




[email protected]

Merge Cells in VBA
 
Great. Thank you.

davegb wrote:
wrote:
Is there a way to merge cells in VBA?


Selection.Merge

The easiest way to figure out something like this is to just record a
macro while you do it, like merging, then look at the macro. Works in
many cases. In some, a recorded macro does it differently than you'd
normally code it, but it's a start.



[email protected]

Merge Cells in VBA
 
Nope. I wanted Selection.Merge

Ron de Bruin wrote:
Do you want this ??

Sub test()
Dim cell As Range
Dim str As String
For Each cell In Range("A1:A10")
str = str & cell.Value
Next cell
MsgBox str
End Sub


--
Regards Ron De Bruin
http://www.rondebruin.nl



wrote in message oups.com...
Is there a way to merge cells in VBA?




All times are GMT +1. The time now is 07:01 AM.

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