VBA date doesn't match with date in workbook

Strooprover

New Member
Joined
Jul 21, 2017
Messages
25
Hi all,

The format of the dates that I'm using are different although I both formatted them in the same way. I copied them to a cell in my workbook and the date that is visible in the cell and the date that is visible in the inputbox above the workbook stay different. It's like super frustrating. Please help.

Thanks in advance.

Code:
M = 1


For x = 16 To 27


Cells(5, x) = DateSerial(2017, M, 1)
Cells(5, x).NumberFormat = "dd/mm/yyyy"
M = M + 1


Next x




Footerdate = Format(DateSerial(Year(Now()), Month(Now()), Day(Now())))
Cells(1, 16).Value = Footerdate
Cells(1, 16).NumberFormat = "dd/mm/yyyy"


For x = 16 To 27




If Cells(1, 16) = Cells(5, x) Then


MsgBox "Check", vbOKOnly


End If


Next x
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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