sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Hey Guys-
I have this If Then piece I've put together that's supposed to choose one of two formulas for a cell, based on what the previous sheet is, and then input that formula into the cell. It does this for two different cells. Currently I have something wrong because both cells just come back equaling zero.
Thanks for the help!
Note- It's in the middle of another macro that builds the whole sheet, thus no end sub etc etc
I have this If Then piece I've put together that's supposed to choose one of two formulas for a cell, based on what the previous sheet is, and then input that formula into the cell. It does this for two different cells. Currently I have something wrong because both cells just come back equaling zero.
Thanks for the help!
Note- It's in the middle of another macro that builds the whole sheet, thus no end sub etc etc
Code:
Dim Form1 As Double Dim Form2 As Double
Dim Form3 As Double
Dim Form4 As Double
Dim ws As Worksheet
Set ws = ActiveSheet.Previous
Form1 = Range("N7").FormulaR1C1 = "=IF(R[22]C[10]="""",R[1]C-PrevSheet(R[1]C),R[22]C[10])"
Form2 = Range("N7").FormulaR1C1 = "=R[1]C"
Form3 = Range("N8").FormulaR1C1 = "=IF(R[22]C[10]="""",IF(R[12]C[12]=""Yes"",(IF(PrevSheet(R[3]C)='Voyage Specifics'!R[3]C[-11],'Voyage Specifics'!R[3]C[-11],PrevSheet(R[3]C))),R[1]C[4]+'Voyage Specifics'!R[4]C[-11]),R[22]C[10])"
Form4 = Range("N8").FormulaR1C1 = "=IF(R[22]C[10]="""",'Voyage Specifics'!R[3]C[-11],R[22]C[10]"
If ws.Name Like "Noon*" Then
ActiveSheet.Range("N7") = Form1
ActiveSheet.Range("N8") = Form3
Else: ActiveSheet.Range("N7") = Form2
ActiveSheet.Range("N8") = Form4
End If