OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 439
- Office Version
- 2019
- Platform
- Windows
Thanks in advance and Season Greetings!
How to set alignment through a text string and avoid getting the error "Run-time error '1004': Application-defined or object-defined error"?
Code is as follows:
How to set alignment through a text string and avoid getting the error "Run-time error '1004': Application-defined or object-defined error"?
Code is as follows:
VBA Code:
Option Explicit
Sub AlignmentTestDoesNotWork()
Dim HzAlng As String
HzAlng = "xlRight"
Sheets("Sheet1").Cells(2, 2).HorizontalAlignment = HzAlng
End Sub