Question: suppose we have a table: MASTER\_X\_Y in the database.

I want the syntax to run the query :

```
INSERT INTO MASTER_VARIABLE1_VARIABLE2 VALUES (.....);

```

where VARIABLE1 and VARIABLE2 have values X and Y respectively which have been selected from another table.

Is this possible ?  

( I have 38 possible combinations of X and Y and simply want to insert the selected data into the correct tables. Is there any other approach ? )

I am using oracle SQL 11g.  

This is the first time I am writing a PL/SQL procedure and I am not getting any straightforward answers.

Thank you !

Answer: 
Putting numbers in quotation marks turns them into a String. Since you want the user to input a number, you should make the following changes:

```
    Dim NumberOfCopies As Int
NumberOfCopies = Application.InputBox("How many copies do you want to print Must enter 0-10", Type:=1)

If NumberofCopies >= 11 Then
...

If NumberOfCopies = 0 or NumberOfCopies = "" Then
...

```
`Type:=2` is actually for Text type. You are working with numbers, so you should set it as `Type:=1`. With that, if the user enters anything that is not a number, it will automatically pop up a message "Number is not valid" (no scripting effort required for that). 

You should also avoid using Position labels whenever you can. Your code could be easily scripted with `Do...While` loops. 

As already pointed out, when working with numbers, do not use them enclosed in double quotes, or VBA will treat them as String (which is not what you want). 

@Rdster brought a good point for when user hits "Cancel" button. When that occurs, the value of your variable will be "False"(a String), so you should look for that either.

With all of that being said, I believe your code would work better like this:

```
'ASKS HOW MANY COPIES TO PRINT
Dim NumberOfCopies As String
Do
    NumberOfCopies = Application.InputBox("How many copies do you want to print? Must enter 0-10", Type:=1)
    If NumberOfCopies = "False" Then Exit Sub   ' If user clicks on Cancel button
    If NumberOfCopies > 10 Then
        MsgBox "Max to print is 10 copies"
    End If
Loop While NumberOfCopies > 10    'although producing the same result, it is cleaner to compare with 10, than to >=11

'Avoid leaving blank conditions. Work with what you have.
'Everything that doesn't match your conditions will be skipped anyways.
If NumberOfCopies > 0 And NumberOfCopies < 10 Then
    ActiveSheet.PrintOut copies:=NumberOfCopies
End If

```