VBA returns wrong date string

2

I made a code to return a string from the first day of the month acts:

Dia = "1/" & CStr(Month(Now)) & "/" & CStr(Year(Now))

Then I put it in a cell

Cells(rowx,colx).value = Dia

The pasted value change position the day with the month, for some reason ... Is there any other way to get this number, it returns "2/1/2016"?

    
asked by anonymous 02.02.2016 / 21:15

1 answer

1

I was able to make a change by placing the variable only as

Dia = CStr(Month(Now)) & "/" & CStr(Year(Now))

excel places the date with cell formatting and assigned the correct value

    
02.02.2016 / 22:02