If you're applying it to multiple sheets, rather than repeating this code in every sheet you can place this in the ThisWorkbook code.
Delete the code from the individual worksheets.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim t As Long
Dim valRng As Range
Dim f As String
With Target
If .Count <> 1 Then Exit Sub
If Len(.Value) = 0 Then Exit Sub
On Error Resume Next
t = .Validation.Type
On Error GoTo 0
If t = 3 Then
f = .Validation.Formula1
On Error Resume Next
Set valRng = Worksheets(Replace(Split(f, "!")(0), "=", "")).Range(Split(f, "!")(1))
On Error GoTo 0
If Not valRng Is Nothing Then
m = Application.Match(.Value, valRng, 0)
If Not IsError(m) Then .HorizontalAlignment = valRng.cells(m, 1).HorizontalAlignment
End If
End If
End With
End Sub
Bookmarks