excel vba - Date formatting - making dd/m/yyyy into dd/mm/yyyy -


i got pretty simple question (but yet i've been stuck @ time now). know how make date value dd/m/yyyy dd/mm/yyyy in variable?

dim lastdaylastmonth date  lastdaylastmonth = dateserial(year(date), month(date), 0) 

so code, of now, return last day of last month, 31/5/2015. sake of formatting, , mid() down along code pull out month string "05", need convert date dd/mm/yyyy or 31/05/2015. know simple solution this? i've tried:

lastdaylastmonth = format(dateserial(year(date), month(date), 0), "dd/mm/yyyy") 

and still returns same value! heroes out there? :d

use string

sub dural()     dim lastdaylastmonth string     lastdaylastmonth = format(dateserial(year(date), month(date), 0), "dd/mm/yyyy")     msgbox lastdaylastmonth end sub 

enter image description here


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -