View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default 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