ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Merge an entire row (https://www.excelbanter.com/excel-programming/334255-merge-entire-row.html)

Norman Jones

Merge an entire row
 
Hi Guy,

Try:

Sub Macro1()
Dim r As Long
Dim rng As Range

r = 2
Set rng = Rows(r)

rng.MergeCells = True

End Sub

---
Regards,
Norman



"Joe" wrote in message
...
Hi all
How do I use the range object (vba) to merge an entire row (lets say row
r).
TIA
Guy




Norman Jones

Merge an entire row
 
Hi Stuart,

Sub Macro2()
Dim r As Long
Dim rng As Range

r = 10

Set rng = Cells(r, 1).Resize(1, 4)

rng.MergeCells = True

End Sub


---
Regards,
Norman



"Joe" wrote in message
...
Thanks Norman.

What if I know the row (r)
And I want to merge only the first four columns
(e.g merge A10 to D10)
Again - I have the row number r.

TIA
Guy

"Norman Jones" wrote in message
...
Hi Guy,

Try:

Sub Macro1()
Dim r As Long
Dim rng As Range

r = 2
Set rng = Rows(r)

rng.MergeCells = True

End Sub

---
Regards,
Norman



"Joe" wrote in message
...
Hi all
How do I use the range object (vba) to merge an entire row (lets say row
r).
TIA
Guy








Joe[_39_]

Merge an entire row
 
Hi all
How do I use the range object (vba) to merge an entire row (lets say row r).
TIA
Guy



Joe[_39_]

Merge an entire row
 
Thanks Norman.

What if I know the row (r)
And I want to merge only the first four columns
(e.g merge A10 to D10)
Again - I have the row number r.

TIA
Guy

"Norman Jones" wrote in message
...
Hi Guy,

Try:

Sub Macro1()
Dim r As Long
Dim rng As Range

r = 2
Set rng = Rows(r)

rng.MergeCells = True

End Sub

---
Regards,
Norman



"Joe" wrote in message
...
Hi all
How do I use the range object (vba) to merge an entire row (lets say row
r).
TIA
Guy







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

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