Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Not Application.Intersect(Range("D2:L4"), Range(Target.Address)) Is Nothing Then
- 'If you add (an)other row(s) edit this code above
- Call DeleteP2P4
- 'If you add (an)other row(s) edit this code above
- Call SampleMacro
- End If
- End Sub
- Sub DeleteP2P4()
- Range("P2:P4").Select
- 'If you add (an)other row(s) edit this code above
- Selection.ClearContents
- End Sub
- Sub SampleMacro()
- ' Get the last row
- Dim startRow As Long, lastRow As Long
- startRow = 2
- lastRow = Sheet1.Cells(Sheet1.Rows.Count, 1).End(xlUp).Row
- For i = startRow To lastRow
- ' If there's Yes/Mediocre in D column, then append next number
- If Sheet1.Range("D" & i).Value = "Yes" Then
- Sheet1.Range("P" & i).Value = "+1"
- ElseIf Sheet1.Range("D" & i).Value = "Mediocre" Then
- Sheet1.Range("P" & i).Value = "+0.5"
- End If
- ' If there's Yes/Mediocre in E column, then append next number
- If Sheet1.Range("E" & i).Value = "Yes" Then
- Sheet1.Range("P" & i).Value = "+1"
- ElseIf Sheet1.Range("E" & i).Value = "Mediocre" Then
- Sheet1.Range("P" & i).Value = "+0.5"
- End If
- 'It continious here with the rest of the If statements
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement