select case not able to run module?


Posted by andy evans on November 15, 2001 4:58 AM

Dear all

have set up a number of modules plus a user form.

The user form has the following code

Private Sub CommandButton1_Click()
Select Case ComboBox1.Value
Case "Junior Wheelchair"
findjw
End Select
End Sub

it will of course have several more 'cases'

but when i run it i get the following msg
compile error
expected variable or procedure, not module

does that mean i can't use it to run a module?

(I can solve it with 'if' statements but I dont want to!)

andy

Posted by Dank on November 15, 2001 5:18 AM

Andy,

Is findjw a procedure in a module? Does it start like this:-

Sub findjw()

or like this

Private Sub findjw()

If it's the latter then change it to the former. If this isn't the problem then you could email me it to vbaconsultancy@hotmail.com.

Regards,
Daniel.



Posted by andy evans on November 15, 2001 5:24 AM

this is the module (and versions of it) that I want to run.
have used findjw in other user forms fine but now i am using case it falls over!

Sub findjw()
Dim c

On Error Resume Next
Set c = Worksheets("loanrecord").Range("c6:c7").find("IN")
If Not c Is Nothing Then
Range(c.Address).Select
ActiveCell = "OUT"
Else
MsgBox "There are no Juniors Wheelchairs currently available"
End If
On Error GoTo 0
Set c = Nothing

End Sub