pradeep kalele
New Member
I have the following code for excel vba. The last line (I made it bold for your convenience) intend to align the contents of the cell in the center. I am receiving error as "Unable to set the HorizontalAlingment property of the range class." Kindly help
Sub SetGrades()
Dim Score As Integer
Score = ActiveCell.Value
If Score >= 90 And Score <= 100 Then
ActiveCell(1, 2).Value = "A"
ActiveCell(1, 2).Interior.ColorIndex = 4
ActiveCell(1, 2).HorizontalAlignment = xlCentre
End If
End Sub
Sub SetGrades()
Dim Score As Integer
Score = ActiveCell.Value
If Score >= 90 And Score <= 100 Then
ActiveCell(1, 2).Value = "A"
ActiveCell(1, 2).Interior.ColorIndex = 4
ActiveCell(1, 2).HorizontalAlignment = xlCentre
End If
End Sub