ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format dates and not Zeros (https://www.excelbanter.com/excel-programming/299703-format-dates-not-zeros.html)

No Name

Format dates and not Zeros
 
I need some code to:
I have a column (F) that contains dates and zeros. How
can I change the format to date (YYYYMMDD) and leave the
zeros as zeros and not get the 19000100 date?

0
6/7/2004
7/19/2004
0
0
0
0
0
1/31/2005
3/14/2005
9/13/2004
10/18/2004
1/31/2005
7/12/2004


Frank Kabel

Format dates and not Zeros
 
Hi
not possible without manually changing the format for these zero cells

--
Regards
Frank Kabel
Frankfurt, Germany

schrieb im Newsbeitrag
...
I need some code to:
I have a column (F) that contains dates and zeros. How
can I change the format to date (YYYYMMDD) and leave the
zeros as zeros and not get the 19000100 date?

0
6/7/2004
7/19/2004
0
0
0
0
0
1/31/2005
3/14/2005
9/13/2004
10/18/2004
1/31/2005
7/12/2004



Ron Rosenfeld

Format dates and not Zeros
 
On Thu, 27 May 2004 11:50:36 -0700,
wrote:

I need some code to:
I have a column (F) that contains dates and zeros. How
can I change the format to date (YYYYMMDD) and leave the
zeros as zeros and not get the 19000100 date?

0
6/7/2004
7/19/2004
0
0
0
0
0
1/31/2005
3/14/2005
9/13/2004
10/18/2004
1/31/2005
7/12/2004



Format/Cells/Number
Category: Custom
Type: [=0]0;yyyymmdd


--ron

SidBord

Format dates and not Zeros
 
Can you use something like:
Dim N As Integer, Limit As Integer
Limit=(whatever)
For N=1 to Limit
If Range("A" & N).Value < 0 _
Then Format(Range("A" & N).Value,"YYYMMDD")
End For

-----Original Message-----
I need some code to:
I have a column (F) that contains dates and zeros. How
can I change the format to date (YYYYMMDD) and leave the
zeros as zeros and not get the 19000100 date?

0
6/7/2004
7/19/2004
0
0
0
0
0
1/31/2005
3/14/2005
9/13/2004
10/18/2004
1/31/2005
7/12/2004

.


Ron Rosenfeld

Format dates and not Zeros
 
On Thu, 27 May 2004 15:36:13 -0400, Ron Rosenfeld
wrote:

On Thu, 27 May 2004 11:50:36 -0700,
wrote:

I need some code to:
I have a column (F) that contains dates and zeros. How
can I change the format to date (YYYYMMDD) and leave the
zeros as zeros and not get the 19000100 date?

0
6/7/2004
7/19/2004
0
0
0
0
0
1/31/2005
3/14/2005
9/13/2004
10/18/2004
1/31/2005
7/12/2004



Format/Cells/Number
Category: Custom
Type: [=0]0;yyyymmdd


--ron


I missed that you wanted VBA code to do this:

Range("F:F").NumberFormat = "[=0]0;yyyymmdd"



--ron


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com