ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HorizontalAlignment Error in Excel 97 (https://www.excelbanter.com/excel-programming/336401-horizontalalignment-error-excel-97-a.html)

Werner[_35_]

HorizontalAlignment Error in Excel 97
 

Hi,

I have a HorizontalAlignment line code that doesn't want to work. It
says : "Error '1004' : Unable to set the HorizontalAlignment property
of the Range class.". I am in Excel 97 and it is frustrating not being
able to do such a simple task with VBA. It shouldn't be difficult.
Cells are not even merged. Any ideas?

Werner


Code:
--------------------


Worksheets("Formulaire").Range("A6:AE11").Select
With Selection
.HorizontalAlignment = xlLeft
End With

--------------------


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=392946


K Dales[_2_]

HorizontalAlignment Error in Excel 97
 
Try this:
..HorizontalAlignment = xlHAlignLeft

--
- K Dales


"Werner" wrote:


Hi,

I have a HorizontalAlignment line code that doesn't want to work. It
says : "Error '1004' : Unable to set the HorizontalAlignment property
of the Range class.". I am in Excel 97 and it is frustrating not being
able to do such a simple task with VBA. It shouldn't be difficult.
Cells are not even merged. Any ideas?

Werner


Code:
--------------------


Worksheets("Formulaire").Range("A6:AE11").Select
With Selection
.HorizontalAlignment = xlLeft
End With

--------------------


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=392946



Werner[_36_]

HorizontalAlignment Error in Excel 97
 

It works! Thanks a lot!

Regards,

Werner


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=392946



All times are GMT +1. The time now is 03:06 PM.

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