Hello,
I'm still at the very basics of VBA and I would really love it if someone could help me out because this stuff is so tricky!
Basically, I am learning how to add more rules using VBA (and I have a few more to go) but I'm kind of stuck because I keep getting the "Const mRange as String error" appearing in my Excel 2003 macro. Below is the code - any help would be fantastic!!
Private Sub Worksheet_Change(ByVal Target As Range)
Const mRange As String = "O21:BH450"
Dim myPlage As Range, c As Range
Set myPlage = Me.Range(mRange)
For Each c In myPlage
With c
Select Case UCase(.Value)
Case "N"
.Interior.ColorIndex = 38
Case "N/A"
.Interior.ColorIndex = 48
Case "EXEMPT"
.Interior.ColorIndex = 48
Case "Y"
.Interior.ColorIndex = 4
Case "NOMINATED"
.Interior.ColorIndex = 41
Case "ENROLLED"
.Interior.ColorIndex = 6
Case ""
.Interior.ColorIndex = 38
Case Else
.Interior.ColorIndex = xlNone
End Select
End With
Next c
Const mRange As String = "BJ21:BJ450"
Dim myPlage As Range, c As Range
Set myPlage = Me.Range(mRange)
For Each c In myPlage
With c
Select Case UCase(.Value)
Case "N/A"
.Interior.ColorIndex = 48
Case ""
.Interior.ColorIndex = 38
Case Else
.Interior.ColorIndex = xlNone
End Select
End With
Next c
End Sub
Any thoughts??
I'm still at the very basics of VBA and I would really love it if someone could help me out because this stuff is so tricky!
Basically, I am learning how to add more rules using VBA (and I have a few more to go) but I'm kind of stuck because I keep getting the "Const mRange as String error" appearing in my Excel 2003 macro. Below is the code - any help would be fantastic!!
Private Sub Worksheet_Change(ByVal Target As Range)
Const mRange As String = "O21:BH450"
Dim myPlage As Range, c As Range
Set myPlage = Me.Range(mRange)
For Each c In myPlage
With c
Select Case UCase(.Value)
Case "N"
.Interior.ColorIndex = 38
Case "N/A"
.Interior.ColorIndex = 48
Case "EXEMPT"
.Interior.ColorIndex = 48
Case "Y"
.Interior.ColorIndex = 4
Case "NOMINATED"
.Interior.ColorIndex = 41
Case "ENROLLED"
.Interior.ColorIndex = 6
Case ""
.Interior.ColorIndex = 38
Case Else
.Interior.ColorIndex = xlNone
End Select
End With
Next c
Const mRange As String = "BJ21:BJ450"
Dim myPlage As Range, c As Range
Set myPlage = Me.Range(mRange)
For Each c In myPlage
With c
Select Case UCase(.Value)
Case "N/A"
.Interior.ColorIndex = 48
Case ""
.Interior.ColorIndex = 38
Case Else
.Interior.ColorIndex = xlNone
End Select
End With
Next c
End Sub
Any thoughts??