JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,532
- Office Version
- 365
- Platform
- Windows
I am trying to write a simple UDF to access a range of cells in the calling sheet. Here's the code:
I've used that exact statement in other code and it works. What am I doing wrong here?
It is called from a sheet that passesd it a range of 4 cells. I'm including a screenshot. I'm not using xl2bb because the UDF is in an add-in and I didn't know what xl2bb would do with that. I can frepost using xl2bb if that will work.
VBA Code:
Public Function Test(pWts As Range) As Long
MsgBox "Hi"
Dim NumWts
NumWts = Range(pWts).rows.Count 'This statrement gets the #VALUE error
Test = 0
End Function
I've used that exact statement in other code and it works. What am I doing wrong here?
It is called from a sheet that passesd it a range of 4 cells. I'm including a screenshot. I'm not using xl2bb because the UDF is in an add-in and I didn't know what xl2bb would do with that. I can frepost using xl2bb if that will work.