Reputation: 533
I have a function, I would like it to subtract dates from me and create a new column. However, it does not work, it shows me an error here
.Value = Evaluate("if({1}," & .Offset(, -2).Address & "-" & .Offset(, -1).Address & ","""")")
Set shtResult = Sheets.Add.Name = "NPE"
But not help. Below is my code :
With wbMe.Sheets("NPE").Range("G2", Range("A" & Rows.Count).End(xlUp).Offset(, 1))
.Value = Evaluate("if({1}," & .Offset(, -2).Address & "-" & .Offset(, -1).Address & ","""")")
End With
Upvotes: 0
Views: 82
Reputation: 533
Solution for above:
With wbMe.Sheets("Arkusz3").Range("G2:G" & Range("A" & Rows.Count).End(xlUp).Row)
.Value = .worksheet.Evaluate("if({1}," & .Offset(, -3).Address & "-" & .Offset(, -2).Address & ","""")")
End With
Upvotes: 1