It's generally considered a best practice not to change inputs, although there is nothing preventing your from doing so - those arguments are treated just like variables inside the procedure. For short, simple functions you can get away with it. But if you have a longer, more complex function and you stick to never changing inputs, your code becomes much easier to maintain.
Say you get a date from the user, but you want to go back to the last statement date which is always the last day of the previous month. You can manipulate the argument like
Public Function LastStatementAmount(ByVal inputDate As Date) As Double
Dim Return_ As Double
inputDate = DateSerial(Year(inputDate), Month(inputDate), 0)
'do calculations here
LastStatementAmount = Return_
End Function
and that works. But the better way is to change the variable name to reflect what changes you made to the value
Public Function LastStatementAmount(ByVal inputDate As Date) As Double
Dim Return_ As Double
Dim stmtDate As Date
stmtDate = DateSerial(Year(inputDate), Month(inputDate), 0)
'do calculations here
LastStatementAmount = Return_
End Function
If this were a larger function, it would be better to see stmtDate and know that you had already modified the input date.
Another reason not to change an input parameter, as mentioned in the comments, is that if you don't specify a passing mechanism, the parameter is, by default, ByRef and if the calling procedure is expecting that the value didn't change, you might break the code. You should always specify ByVal or ByRef so it's clear what your code intends.
Functiondon't you want to assign the result totest? liketest = DateSerial(Year(date1), 10, Day(date1))?Docycle incremeneting it and storing the dates in a collection that will be returned.ByVal-ByRefis the default and allows you to change the original variable.