Date Format works for one column, but not the other

crumbcounter

New Member
Joined
Sep 27, 2016
Messages
11
Hello one of two lines are not working in Macro


Columns("C:C").NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"
Columns("D:D").NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"


Only works for column C. I have tried combining the lines "C:D", reversing order, and only having line for D. Column D is not reformatting. Any clues?

[TABLE="width: 1131"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]
Task[/TD]
[TD]Resources[/TD]
[TD]Start Date[/TD]
[TD]End Date[/TD]
[TD]Status[/TD]
[/TR]
[TR]
[TD]Addresses, Dates, Contact Info, Drawings, Drops, and Other Info[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]29-Nov-16[/TD]
[TD]08/May/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
[TR]
[TD]Set up Recycling[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]31-Mar-17[/TD]
[TD]14/Apr/2017[/TD]
[TD]Overdue[/TD]
[/TR]
[TR]
[TD]IT Presence Book Flight and Hotel[/TD]
[TD]helpdesk[/TD]
[TD="align: right"]14-Apr-17[/TD]
[TD]18/Apr/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
[TR]
[TD]IT Building Access[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]31-Mar-17[/TD]
[TD]21/Apr/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
[TR]
[TD]IT Suite Access[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]31-Mar-17[/TD]
[TD]21/Apr/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
[TR]
[TD]Give IT Presence Schedule and Contacts[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]14-Apr-17[/TD]
[TD]21/Apr/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
[TR]
[TD]Make sure Workstation items are sent to current office[/TD]
[TD]Ben Gallahan[/TD]
[TD="align: right"]14-Apr-17[/TD]
[TD]23/Apr/2017[/TD]
[TD]Upcoming[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What happens with the below?

Code:
Columns("D:D").Replace What:="/", Replacement:="-", LookAt:=xlPart
Columns("C:D").NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"
 
Upvote 0
What happens with the below?

Code:
Columns("D:D").Replace What:="/", Replacement:="-", LookAt:=xlPart
Columns("C:D").NumberFormat = "[$-x-sysdate]dddd, mmmm dd, yyyy"


Figured out the problem. Sorry for wasting your time. Problem was with another part of the macro.


Columns("F:F").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 3), TrailingMinusNumbers:=True


Columns("J:J").Select
Selection.TextToColumns Destination:=Range("I1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 3), TrailingMinusNumbers:=True


I will be experimenting with outlook integration. Will probably have problems. Ill post under new thread. Thanks again
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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