A Cell doesn't show the date formatting as set in VBA

Ramadan2512

Board Regular
Joined
Sep 7, 2024
Messages
68
Office Version
  1. 2021
Platform
  1. Windows
I have a work sheet with a combined long VBA code and one of these vba rules is to insert today() date in cell "D11" in case if any changes in cells E5 or G5 .... the code was working perfectly but suddenly maybe i did something wrong made the date formating in D11 dont appear as I need .... I have tried everything like text to column and cell formatting and even changing dae setting in my windows but still the date format in cell D11 only give me one single format like this (02.10.2024) while to format in vba is
VBA Code:
[For r = LBound(a) To UBound(a)
        If Target.Address(0, 0) = a(r, 2) Then 'consider using If Not Intersect(Target, Range("E5,G5") or Range("E5:G5")) Is Nothing Then...with other changes in the code if you want to change multiple conditions in one swoop
            ws.Range("D11").Value = Format(ThisWorkbook.BuiltinDocumentProperties("Last Save time"), "short date")
            ws.Range("D11").NumberFormat = "[$-,200]yyyy/m/d;@"]


do anyone please has a suggesstion what can i do to fix that issue [CODE=vba]
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
By using the Format function you are entering the date as Text.
Try:
VBA Code:
            ws.Range("D11").NumberFormat = "[$-,200]yyyy/m/d;@"
            ws.Range("D11").Value = ThisWorkbook.BuiltinDocumentProperties("Last Save time")
 
Upvote 1
Solution
By using the Format function you are entering the date as Text.
Try:
VBA Code:
            ws.Range("D11").NumberFormat = "[$-,200]yyyy/m/d;@"
            ws.Range("D11").Value = ThisWorkbook.BuiltinDocumentProperties("Last Save time")
perfect, it works thank you soooooooo much Alex
 
Upvote 0

Forum statistics

Threads
1,224,872
Messages
6,181,501
Members
453,047
Latest member
charlie_odd

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