Hi all,
I have the following code. This is a Worksheet_Change event and I would like to know if it is possible to modify this code so I can execute it when I want, as a normal macro, pressing F5.
Thanks in advance!
I have the following code. This is a Worksheet_Change event and I would like to know if it is possible to modify this code so I can execute it when I want, as a normal macro, pressing F5.
Thanks in advance!
VBA Code:
Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("BV1:BV" & Range("CJ" & Rows.Count).End(xlUp).Row)) Is Nothing Then
Application.ScreenUpdating = False
With Sheets("SYS Agregado")
For MY_ROWS = 2 To .Range("CJ" & Rows.Count).End(xlUp).Row
If .Range("CJ" & MY_ROWS).Value & .Range("CL" & MY_ROWS).Value = _
.Range("CJ" & Target.Row).Value & .Range("CL" & Target.Row).Value Then
MY_TOTAL = MY_TOTAL + .Range("BV" & MY_ROWS).Value
End If
Next MY_ROWS
Sheets(.Range("CJ" & Target.Row).Value).Range(.Range("CL" & Target.Row).Value).Value = MY_TOTAL
End With
Application.ScreenUpdating = True
End If
End Sub