ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MERGE CELLS (https://www.excelbanter.com/excel-programming/336657-merge-cells.html)

ermeko

MERGE CELLS
 
HI,
I WANT TO MERGE CELLS A2:A3 AND THEN ALIGN THR TEXT INSIDE VERTICALLY AND
HORIZONTALLY CENTERED.

Range("A2:A3").MergeCells = True

ActiveSheet.Cells(2, 1).HorizontalAlignment = xlCenter
ActiveSheet.Cells(2, 1).VerticalAlignment = xlVAlignCenter

THE CODE ABOVE DOES NOTHING.

CAN ANYBODY HELP ME?
THANKS

ermeko

MERGE CELLS
 
SORRY,
I FOUND MYSELF:

ActiveSheet.Cells(2, 1).HorizontalAlignment = xlCenter
ActiveSheet.Cells(2, 1).VerticalAlignment = xlVAlignCenter
Range("A2:A3").MergeCells = True

"ermeko" wrote:

HI,
I WANT TO MERGE CELLS A2:A3 AND THEN ALIGN THR TEXT INSIDE VERTICALLY AND
HORIZONTALLY CENTERED.

Range("A2:A3").MergeCells = True

ActiveSheet.Cells(2, 1).HorizontalAlignment = xlCenter
ActiveSheet.Cells(2, 1).VerticalAlignment = xlVAlignCenter

THE CODE ABOVE DOES NOTHING.

CAN ANYBODY HELP ME?
THANKS


Andibevan[_4_]

MERGE CELLS
 
Try:-

Sub testttt()
Range("A2:A3").Select
With Selection
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlVAlignCenter
End With


End Sub

HTH


"ermeko" wrote in message
...
HI,
I WANT TO MERGE CELLS A2:A3 AND THEN ALIGN THR TEXT INSIDE VERTICALLY AND
HORIZONTALLY CENTERED.

Range("A2:A3").MergeCells = True

ActiveSheet.Cells(2, 1).HorizontalAlignment = xlCenter
ActiveSheet.Cells(2, 1).VerticalAlignment = xlVAlignCenter

THE CODE ABOVE DOES NOTHING.

CAN ANYBODY HELP ME?
THANKS





All times are GMT +1. The time now is 06:32 AM.

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