DateSerial

mattDrum

New Member
Joined
Jan 27, 2014
Messages
10
Hallo!

I use DateSerial like this "DateSerial(2014, 4, 1)" in vba.
I wonder if I can do this "DateSerial(201*, 4, 1)" the text in vba gets red like something is wrong, but it still works.
Is there another way to do this? I dont want to chance the code every year!

Thanks!

/Matt
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Matt

If the code goes red it means there's a syntax error and the code won't compile or run.

So I'm not sure what you mean when you say DateSerial(201*, 4, 1) works.

What are you trying to do anyway?
 
Upvote 0
I cant explain the code goes red but it works. I dont know why or how but i does.
I have an excel workbook for every year, if I use "DateSerial(2014, 4, 1)" then i have to change it to "DateSerial(2015, 4, 1)" next year!
I dont want that, that why i wonder if i can do this instead "DateSerial(201*, 4, 1)" or if there is a better way.
/Matt
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

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