How to change date format to General

thespardian

Board Regular
Joined
Aug 31, 2012
Messages
119
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hi there!
I have a date input cell i.e P4. For example the current value of the P4 is 01.01.2020. The cell format is customized thus the date in the P4 cell is being displayed as "dd.mm.yyyy" 01.01.2020. In the Cell P3, I want symbol ">=" and date in the cell P4. So my desired output in the cell P3 is >=43831. (Please note that the date format has been changed from DATE to GENERAL in the cell P3)
i want the help on following code to get my desired result as shown above in the red.

VBA Code:
If Not Intersect(Target, Range("P4")) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
    If Target.Value = Empty Then Range("P3").Value = Empty
    If Target.Value <> Empty Then Range("P3").Value = ">=" & Range("P4")
End if

Any help on the matter will be highly appreciated. TIA
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You can use Range("P4").Value2 to get the date value back as a number, rather than date.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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