cherosoullis
11-27-2006, 05:12 AM
Because I want a conditional validation in excel I decided to do it with VB.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Sheets("MAIN").Range("C5").Value = "A:0-1650" Then
Sheets("MAIN").Range("C7").Value = "> 0"
Sheets("MAIN").Range("C7").Value = "<1650"
else
If Sheets("MAIN").Range("C5").Value = "B:1651-2025" Then
Sheets("MAIN").Range("C7").Value = "> 1651"
Sheets("MAIN").Range("C7").Value = "<2025"
End If
End Sub
This code does not work. I dont know why. Please help me.
The A and B are values from a drop down list. According with this selection I want to validate C7 cell with minimum and maximum values and stopping wrorg values
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Sheets("MAIN").Range("C5").Value = "A:0-1650" Then
Sheets("MAIN").Range("C7").Value = "> 0"
Sheets("MAIN").Range("C7").Value = "<1650"
else
If Sheets("MAIN").Range("C5").Value = "B:1651-2025" Then
Sheets("MAIN").Range("C7").Value = "> 1651"
Sheets("MAIN").Range("C7").Value = "<2025"
End If
End Sub
This code does not work. I dont know why. Please help me.
The A and B are values from a drop down list. According with this selection I want to validate C7 cell with minimum and maximum values and stopping wrorg values