Hi i have a macro that is supposed to execute everytime something is changed on a sheet other than the summary one. the code is as follows
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim R As Long
Dim C As Integer
Dim num As Integer
Dim lastrow As Integer
Dim lastcol As Integer
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
num = 0
If ActiveSheet.Name = "Summary" Then
'Do Nothing
Else
For R = 2 To lastrow
If IsEmpty(Cells(R, 1)) Then
Cells(R, 2) = ""
Else
num = 0
For C = 3 To lastcol
If IsEmpty(Cells(R, C)) Then
'Do Nothing
Else
num = num + 1
End If
Debug.Print ("Congratulationgs you've made it to checkpoint 1")
Next C
Cells(R, 2) = num
End If
Debug.Print ("Congratulationgs you've made it to checkpoint 2")
Next R
End If
End Sub
The problem is that the code will run and do what its supposed to. But then it won't stop and i have to break it to to unfreeze my excel program. any help?
Bookmarks