You must change the header of your function by this
Code:
Public Function checkstate(f24 As Range)
and in excell you can enter the address of the cell like for another excel's function (=checkstate(F24))