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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0
Hi Epicfail,

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

Hope this works for you.
 
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