Hello there,
I'm trying to sum the value in a cell with a value from a formula; i've tried everything as i can imagine, with no results.
Here's the code:
Sub Macro2()
Dim Cell As Range
Dim Myval As Variant
Myval = ActiveCell.Value
Input1= "=+SUMIFS(Values1,Mech1,R[0]c2,Data_Limites,R2C)"
Input2 = "=+COUNTIFS(Values2,R[-1]C2,DR,R2C)"
Input3 = "=+COUNTIFS(Values2,R[-2]C2,DT,R2C)"
For Each Cell In Selection
If Range("C" & Cell.Row).Text = "Data1" Then
Cell.Select
If ActiveCell.Value = "" Then
Cell.FormulaR1C1 = Input1
End If
End If
If Range("C" & Cell.Row).Text = "Data2" Then
Cell.Select
If ActiveCell.Value = "" Then
Cell.Value = Input2
Else
Cell.Value = Myval + Input
End If
End If
If Range("c" & Cell.Row).Text = "Data3" Then
Cell.Select
ActiveCell.FormulaR1C1 = Input3
End If
Next
End Sub
Can you help me in this one?
Thanks in advace
Bookmarks