tonyrosen
12-20-2005, 01:23 PM
Okay, I have the following code:
Sub ValidateConsolidationSheet()
Dim x As Integer
Dim wSheets As Worksheet
Set wSheets = Worksheets("Sheet1")
For x = 1 To 5
If Range("EndingBalance" & x) <> Range("PerGL" & x) Then
wSheets.Unprotect SYSID
wSheets.Range("EndingBalance" & x).Interior.ColorIndex = 6
wSheets.Range("EndingBalance" & x).AddComment ("Ending Balance must equal PerGL82")
wSheets.Protect SYSID
Else
wSheets.Unprotect SYSID
wSheets.Range("EndingBalance" & x).Interior.ColorIndex = 0
wSheets.Protect SYSID
End If
Next x
End Sub
However, with the AddComment line, I get a VBA error: 400 (whatever THAT means).
What am I doing incorrectly?
Sub ValidateConsolidationSheet()
Dim x As Integer
Dim wSheets As Worksheet
Set wSheets = Worksheets("Sheet1")
For x = 1 To 5
If Range("EndingBalance" & x) <> Range("PerGL" & x) Then
wSheets.Unprotect SYSID
wSheets.Range("EndingBalance" & x).Interior.ColorIndex = 6
wSheets.Range("EndingBalance" & x).AddComment ("Ending Balance must equal PerGL82")
wSheets.Protect SYSID
Else
wSheets.Unprotect SYSID
wSheets.Range("EndingBalance" & x).Interior.ColorIndex = 0
wSheets.Protect SYSID
End If
Next x
End Sub
However, with the AddComment line, I get a VBA error: 400 (whatever THAT means).
What am I doing incorrectly?