'----------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'
' The following code was created on 10/31/2006 by Stanley D. Grom, Jr.
' Thank you 'lenze', reference 'Oct 31, 2006 4:21 pm Assumming you mean
' a Data Validation List Box, you can use the worksheet change event'
If Target.Address = "$B$1" Then
Select Case Target
Case ""
Range("C1").Select
Range("C1").ClearContents
With Selection.Validation
.Delete
End With
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
End With
Range("B1").Select
Exit Sub
Case "Structures"
Range("C1").Select
Range("C1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$G$2:$G$17"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "Pipework"
Range("C1").Select
Range("C1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$H$2:$H$11"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "MEICA"
Range("C1").Select
Range("C1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$I$2:$I$4"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case Else: Exit Sub
End Select
End If
If Target.Address = "$C$1" Then
Select Case Mid(Target, 1, 1)
Case ""
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
End With
Range("C1").Select
Exit Sub
Case "A" ' - PRELIMINARIES"
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$J$2:$J$9"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "B" ' - GROUND INVESTIGATION"
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$K$2:$K$12"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "C" ' - GEOTECHNICAL AND OTHER SERVICES"
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$L$2:$L$4"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "D" ' - DEMOLITION AND SITE CLEARANCE"
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$M$2:$M$4"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "E" ' - EARTHWORKS"
Range("D1").Select
Range("D1").ClearContents
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=$N$2:$N$9"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Exit Sub
Case "F", "G", "M", "N", "R", "X", "Y", "Z"
Range("D1").Clear
Range("C1").Select
MsgBox "F, G, M, N, R, X, Y, Z, or Miscellaneous, are not setup yet."
Exit Sub
' Setup code for the following selections (see above example)
'F - IN SITU CONCRETE
'G - CONCRETE ANCILLIARIES
'M - STRUCTURAL METALWORK
'N - MISCELLANEOUS METALWORK
'R - ROADS AND PAVINGS
'X - MISCELLANEOUS WORK
'Y - SEWER AND WATER MAIN RENOVATION AND ANCILLIARY WORKS
'Z - CLASS Z: BUILDING WORKS
'? - Miscellaneous
Case Else: Exit Sub
End Select
End If
End Sub
'----------------------------------------------------------