I'm starting with VB in Excel; so far I can't figure the following; I've got the following function:
Function testGetRange(myRange As Range)
Dim weekStart As Integer
Dim weekEnd As Integer
weekStart = myRange(1).Value
weekEnd = myRange(2).Value
End Function
If I try to execute it like that:
Sub CreationRapport()
Dim testRange1 As Range
Set testRange1 = Range("A5:B5")
testGetRange (testRange1)
End Sub
I've got an error like "object needed" (sorry the error message is in French: "objet requis"), stopping right when I try to execute the function.
So: the range is created, the function takes a range as input; don't know why this doesn't work...
testGetRange = .... I use "..." because I can't tell what you want it to return or do. Perhaps you just need a Sub that performs an action. It would be helpful to know what you want to happen.