View Single Post
 
Old 08-02-2014, 11:09 AM
charlesdh charlesdh is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

The reason you go into a continuous look is that each time a chane is made it will fire the macro.
I think you need "Application.EnableEvents = False" as indicated in the code. However, I'm not completely
sure if the placement is correct.
Also please use "Code" tags when you post a code.



Code:
 "Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Target.Interior.ColorIndex = 3
Range("V1") = 0
Range("V1").Interior.ColorIndex = 0
For arow = 1 To 50
Application.EnableEvents = False
    For acol = 1 To 20
        If Cells(arow, acol).Interior.ColorIndex = 3 Then
            Range("V1").Value = Range("V1").Value + 1
        End If
    Next acol
Next arow
Application.EnableEvents = True
End Sub
Reply With Quote