date and time macro or VB?

Epicfail

Board Regular
Joined
Mar 31, 2009
Messages
89
Ok hi guys / gals,

I have a time macro using =now() and i have the cells formated to show either the date or time. But the issue I have is I only want the date or the time entered instead of both. I need it to only have the date in the cell because im using it as a reference point and it doesnt work with the time in the cell also.

Currently-
Cell shows 3/30/09
Entered in cell 3/30/09 12:00:00 pm

Needing-
Cell shows 3/30/09
Entered in cell 3/30/09

Any ideas?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Epicfail

Board Regular
Joined
Mar 31, 2009
Messages
89
i have it formated to mm/dd/yyyy it shows correctly in the cell

But in the formula bar it shows mm/dd/yyyy hh:mm:ss am/pm
 

balajayan

Board Regular
Joined
Nov 12, 2008
Messages
175
Inside the macro to get current date use the "Date" as a variable. For example to assaign current date to variable datefunc the following syntax has to be used.

datefunc = Date

Hope this resolves your issue
 

Epicfail

Board Regular
Joined
Mar 31, 2009
Messages
89
Thnx guys

Another question i hv is can i make one marco do just the date(mm/dd/yyyy) in say cell A1 and then hv it do Time(12:00 pm) in cell A2?
 

balajayan

Board Regular
Joined
Nov 12, 2008
Messages
175
Hi Epicfail,

For the given scenario use the following syntax
Code:
Range("A1").Value = Date
Range("A2").Value = Time

Hope this works for you.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,008
Messages
5,834,852
Members
430,324
Latest member
bosphoruskid

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
Top