i'm having a macro runing depending on the value of the cell I1, every time the value in I1 changes, i want the correponded dependent cell values change, there is one case that i want to clear the contents of certain range but in this case the code happens to run into an infinite loop and i have no idea why here is my code, hope someone could help! thanks all in advance!
Private Sub Clear()
Dim target As Range
Set target = Range("I1")
If Not Intersect(target, Range("I1")) Is Nothing Then
Select Case Range("I1").Value
Case 1
Application.ScreenUpdating = False
' ________bug starts the next line___________
Range("H13,D27,H27").Value = ""
ActiveSheet.Range("I13:I20").ClearContents
Range("C4").Select
Application.ScreenUpdating = True
Case 2
Range("H13,D27,H27").Value = "left"
Range("I13,E27,I27").Value = "right"
Case 3
Range("H13,D27,H27").Value = "lateral"
Range("I13,E27,I27").Value = "central"
End Select
End If
End Sub
Bookmarks