-
Dec 12th, 2007, 06:15 PM
#1
Thread Starter
New Member
From function to sub
Hey..
I'm having troubles to get info from my function, and back again to my sub.. whats wrong?
Code:
Public Sub Member()
Dim MemberID As Integer
Dim Member As Integer
Do
MemberID = InputBox("write membernumber", "which member du you want?")
TFMember= TjeckMember(MemberID)
If TFMember= False Then
MsgBox ("member not valid. try again.")
End If
Loop Until Member = 1
End Sub
Public Function TjeckMember(MemberID As Integer) As Integer
Dim IDRange As Range
Dim ID As Variant
With ThisWorkbook.Worksheets("Members")
Set IDRange = Range(Range("A2"), Range("A2").End(xlDown))
For Each ID In IDRange
If ID = MemberID Then
TFMember= True
Exit For
Else
TFMember = False
End If
Next ID
End With
End Function
Really hope you can help...
Bjede
-
Dec 12th, 2007, 06:18 PM
#2
Re: From function to sub
First, this belongs in a technical forum.
Second, you aren't returning a value within your function. You have the function defined to return an Integer, but you never specify TO return said integer.
-
Dec 12th, 2007, 06:22 PM
#3
Thread Starter
New Member
Re: From function to sub
Sorry.. are there any technical forum in here?
-
Dec 12th, 2007, 06:23 PM
#4
Re: From function to sub
Most of them are technical. Don't worry, a mod will move it once they see it.
-
Dec 12th, 2007, 06:29 PM
#5
Thread Starter
New Member
-
Dec 12th, 2007, 06:35 PM
#6
Thread Starter
New Member
-
Dec 12th, 2007, 06:36 PM
#7
Re: From function to sub
As you appear to be working in Excel, I have moved this thread to our Office Development forum.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|