Hi jvuorela,
If you are in any case going to insert it into Excel then I would suggest directly making use of the in-built Excel formula.
By "last day" if you meant the name of the day then the formula is: =TEXT(EOMONTH(TODAY(),-1),"dddd")
which will return Monday
If you meant the date then the formula is =EOMONTH(TODAY(),-1)
which will return 30-04-18
You can format the date as required.
Insert the above formula starting with the = sign in the Excel you are working. Once you get the result in the cell then you can store it in any variable and delete/clear the cell value containing the formula.