Skip to content

Instantly share code, notes, and snippets.

@gaulatti
Last active November 10, 2018 03:21
Show Gist options
  • Save gaulatti/4a495a5b09b449602d692e8677e4cd22 to your computer and use it in GitHub Desktop.
Save gaulatti/4a495a5b09b449602d692e8677e4cd22 to your computer and use it in GitHub Desktop.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rango_a_calcular As Range
Set rango_a_calcular = Range("D3:F12")
If Not Application.Intersect(rango_a_calcular, Range(Target.Address)) Is Nothing Then
For i = 1 To rango_a_calcular.Rows.Count
Dim fila_actual As Integer
Dim medida_2 As Integer
Dim medida_3 As Integer
Dim medida_4 As Integer
fila_actual = rango_a_calcular.Rows(i).Row
medida_2 = Cells(fila_actual, 4).Value
medida_3 = Cells(fila_actual, 5).Value
medida_4 = Cells(fila_actual, 6).Value
Cells(fila_actual, 8 ).Value = (medida_2 + medida_3 + medida_4) / 3
Next
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment