LBoxington
New Member
- Joined
- Aug 16, 2011
- Messages
- 6
So...recently I have been trying to learn how to do the macros on excel better and I recently purchased (recently defined as about a year ago, however, I didn't have much time to read it until recently due to school) called Excel 2007 Power Programming with VBA (since I have office 2007).
I am trying to experiment with using the select case construct.
Private testing_call()
Dim subtocall As String
Dim num As Variant
num = InputBox("Please input either the number 1 or 2")
Select Case num
Case 1: subtocall = "numname"
Case 2: subtocall = "firstname"
End Select
Application.rub subtocall
End Sub
Private Sub numname()
MsgBox "the number you typed is 1"
End Sub
Private Sub firstname()
MsgBox "The number you typed is 2"
End Sub
The line that I bolded is where I keep getting the error. It says "invalid outside procedure," for that line and I have no idea what I have done wrong.
Any ideas?
Another question. What is the difference between a class module and a module?
On a side note, this is my first post as I literally just registered like 10 minutes ago =) The significance of this statement is that if I posted in the wrong area or anything, let me know =).
I am trying to experiment with using the select case construct.
Private testing_call()
Dim subtocall As String
Dim num As Variant
num = InputBox("Please input either the number 1 or 2")
Select Case num
Case 1: subtocall = "numname"
Case 2: subtocall = "firstname"
End Select
Application.rub subtocall
End Sub
Private Sub numname()
MsgBox "the number you typed is 1"
End Sub
Private Sub firstname()
MsgBox "The number you typed is 2"
End Sub
The line that I bolded is where I keep getting the error. It says "invalid outside procedure," for that line and I have no idea what I have done wrong.
Any ideas?
Another question. What is the difference between a class module and a module?
On a side note, this is my first post as I literally just registered like 10 minutes ago =) The significance of this statement is that if I posted in the wrong area or anything, let me know =).