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 glue it to a cell
Cells(rowx,colx).value = Dia
the value pasted change of position the day with the month, for some reason... Is there any other way to get this number, it return "1/2/2016"?
Tried to
Cells(rowx, coly).NumberFormat = "dd/mm/aaaa"
?– Pablo Almeida
tried, managed to solve otherwise, I had paste only the month and year, when it is pasted in excel it puts the 1/ in front alone
– J.A.Reis
I got it. Post your solution as an answer to help the next victim. :)
– Pablo Almeida
First of all, are you sure there isn’t an error in your code? I say this because a function you use seems wrong (you are
years
, but I think it should beyear
). Second, the reason for automated choice is the Excel language you use. In American English the month is displayed first on a date. Here, in my Excel in Portuguese, your code (withyear
), works properly and displays:1/2/2016
.– Luiz Vieira
I quickly redacted the code here, and I’m dyslexic, I didn’t realize I’d put the s there, I’ll edit to remove
– J.A.Reis