Inside each Select Case block where the case is not “Name”, I want to add an if then statement that compares the values in the 2 rows above. If the values are equal then add 15 to the row above and paste the sum into the cell. If the values are not equal, then paste the value from the row above into the cell. Can you help?
Sub CsSlct()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastRow As Long, i As Long
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws2 = ThisWorkbook.Sheets("Sheet2")
lastRow = ws1. Cells(ws1. Rows.Count, "B"). End(xlUp). Row 'get the last row in Sheet1 Column B
For i = 2 To lastRow 'start at row 2 assuming there is a header in row 1
Select Case ws1. Range("B" & i). Value
Case "Name"
ws2. Range("B" & i). Value = "ID"
ws2. Range("A" & i). Value = ws1. Range("A" & i). Value
ws2. Range("C" & i). Value = Val(ws2.Range("C" & i - 1).Value) + 5
Case "Title"
ws2. Range("B" & i). Value = "ID"
ws2. Range("A" & i). Value = ws1. Range("A" & i). Value
‘if then statement
Case "Satisfied"
ws2. Range("B" & i). Value = "ID"
ws2. Range("A" & i). Value = ws1. Range("A" & i). Value
ws2. Range("C" & i). Value = Val(ws2.Range("C" & i - 1).Value) + 5
**‘if then statement**
Case "Percent"
ws2. Range("B" & i). Value = "ID"
ws2. Range("A" & i). Value = ws1. Range("A" & i). Value
‘if then statement
End Select
Next i
End Sub