Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address <> "$A$1" Then Exit Sub ' where cell A1 is the drop down list
Dim i
Dim dropdownlistrange As Range
Set dropdownlistrange = Range("A1") ' where cell A1 is the drop down list
If dropdownlistrange.Value <> "" Then
Range("B3:B11").Interior.ColorIndex = 0
Range("B3:B11").ClearContents
Range("B3:B11").Borders(xlEdgeLeft).LineStyle = xlNone
Range("B3:B11").Borders(xlEdgeTop).LineStyle = xlNone
Range("B3:B11").Borders(xlEdgeBottom).LineStyle = xlNone
Range("B3:B11").Borders(xlEdgeRight).LineStyle = xlNone
Range("B3:B11").Borders(xlInsideVertical).LineStyle = xlNone
Range("B3:B11").Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B3:B" & dropdownlistrange.Value + 2).Select
Selection.Interior.ColorIndex = 6
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
If dropdownlistrange.Value <> 1 Then
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
End If
Range("B3").Select
End If
End Sub