Excel Formula turned into VBA

rasinc

Board Regular
Joined
Jun 28, 2011
Messages
119
I'd like to turn this formula

Code:
=  "pour " & TEXT(StartDate1, "MMM d, yyyy") & " à " & TEXT(EndDate1,"MMM d, yyyy")
into VBA code.

However, the code is part of a loop and each date increments. I was using dtStartDate as the variable for each start date that was reset at the beginning of each loop. dtEndDate is the end date.

I've tried various versions of
Code:
Range("A2") = "= & """"pour"""" & Text(" & dtStartDate & ", """"MMM d, yyyy"""") & """" à """" & Text(" & dtEndDate & ", """"MMM d, yyyy"""") & """""

but I am still having problems. Can anyone give me a hand, I'm hitting a roadblock tonight? TIA rasinc.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try
Code:
Range("A2").Value = "pour " & Format(dtStartDate, "mmmm d, yyyy") & " à " & Format(dtEndDate, "mmmm d, yyyy")
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

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