VBA subtracting two dates and creating a new column

Palucci

Banned user
Joined
Sep 15, 2021
Messages
138
Office Version
  1. 365
Platform
  1. Windows
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
VBA Code:
.Value = Evaluate("if({1}," & .Offset(, -2).Address & "-" & .Offset(, -1).Address & ","""")")
"Application - definied or object - definied error :
VBA Code:
   With wbMe.Sheets("Arkusz3").Range("G2", Range("A" & Rows.Count).End(xlUp).Offset(, 1))
      .Value = Evaluate("if({1}," & .Offset(, -2).Address & "-" & .Offset(, -1).Address & ","""")")
   End With
 
If you are trying to insert header names into row 1, then that is a totally different question & needs a new thread. Thanks
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top