Unable to set the .HorizontalAlignment property of the Range class error

chrisfleetwood

New Member
Joined
Feb 27, 2015
Messages
4
Unable to set the .HorizontalAlignment property of the Range class error

I am encountering this error trying to set HorizontalAlignment in a VB.NET application. I have looked through many articles with solutions on how to resolve this error.

I have tried setting this property in a variety of different contexts (ActiveCell, Range, Selection, ActiveSheet.Cells, etc., etc.) and I am still running into the same error.

Since the code I am working with also protects the active sheet at some point. I've dealt with some other issues in updating a cell where I eventually realized that the cell was within a Excel range I was using elsewhere in the code that had locked the cell in question.

Subsequently, I made sure to unprotect the sheet before attempting to set HorizontalAlignment. Still no luck.

I'm thinking that there may be some external factor that's causing the error over and above the routine syntax/object reference issues.

Any ideas on other factors that would prevent program code from setting HorizontalAlignment? All are appreciated.

Regards,

Chris Fleetwood
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top