cmschmitz24
Board Regular
- Joined
- Jan 27, 2017
- Messages
- 150
Hello, I'm trying to look up a value in column H, then return a value in column V, from a formula specific to what is in column H and column S.
Here is my current VBA code that will not produce what I'm looking for.
Sub Premiums()
Dim Lastrow As Long
Dim myRow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For myRow = 2 To Lastrow
Select Case Left(Cells(myRow, "H"), 1)
Case "A": result = ActiveCell.FormulaR1C1 = "=RC[-3]/12"
Case "C": result = ActiveCell.FormulaR1C1 = "=RC[-3]/12"
Case "H": result = ActiveCell.FormulaR1C1 = "=RC[-3]/24"
Case Else: result = ""
End Select
Cells(myRow, "V") = result
Next myRow
End Sub
The returned value says "FALSE", so I'm thinking the result code is not correct.
Thanks,
Christina
Here is my current VBA code that will not produce what I'm looking for.
Sub Premiums()
Dim Lastrow As Long
Dim myRow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For myRow = 2 To Lastrow
Select Case Left(Cells(myRow, "H"), 1)
Case "A": result = ActiveCell.FormulaR1C1 = "=RC[-3]/12"
Case "C": result = ActiveCell.FormulaR1C1 = "=RC[-3]/12"
Case "H": result = ActiveCell.FormulaR1C1 = "=RC[-3]/24"
Case Else: result = ""
End Select
Cells(myRow, "V") = result
Next myRow
End Sub
The returned value says "FALSE", so I'm thinking the result code is not correct.
Thanks,
Christina