ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   text centering (https://www.excelbanter.com/excel-programming/396722-text-centering.html)

AlanW

text centering
 
I would like to centre the contents in a range by using VBA. Could someone
please help.

Thanks

Halim

text centering
 
Alan,

You can do by this code:
Sub Centering()
With Range("a1")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
end With
End sub

Type your text in A1 then run that code
--
Regards,

Halim



"AlanW" wrote:

I would like to centre the contents in a range by using VBA. Could someone
please help.

Thanks



All times are GMT +1. The time now is 12:11 PM.

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