Cant sort dates in table

Peltz

Board Regular
Joined
Aug 30, 2011
Messages
87
Hi there

Ive written a code that timestamp a certain cell in a table:
Code:
ws2.ListObjects("Table1").DataBodyRange(i, 1).Value = Format(Now(), "dd.mm.yyyy")

However, when trying to filter the dates in the table they are not recognized as dates. The whole collumn in the sheet is formatted as dates beforehand as well. If i try to change formatting the cell to, say (dd.mm.yy), nothing happens (allthough the other dates in the table change).

Any idea on whats going on here?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
That is because the Format function actually returns a Text value, not a Date value (it converts it from Date to Text).
What you should do is to write the value as a Date like this:
Code:
ws2.ListObjects("Table1").DataBodyRange(i, 1).Value = Now()"dd.mm.yyyy")
And simply format the column as "dd.mm.yyyy"
 
Last edited:
Upvote 0
Ahhh, there you go.

I changed the code to
Code:
[/COLOR][COLOR=#333333]ws2.ListObjects("Table1").DataBodyRange(i, 1).Value = Now()[/COLOR][COLOR=#333333]

All is as it should. Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
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