Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Adalicia Martin   on Mar 20 In MS Office Category.

  
Question Answered By: Lee Butler   on Mar 20

Do more testing. Use the VBA help  system. Combine successfully
tested simple statements to form complex statements.


Test this (all one line):

InputBox("1 = Underwater Structure") ("2 = Feeding Structure") ("3 =
Transfer Structure") ("4 = Fixed Structure") ("5 = Custom Structure")
("Enter code  1 thru 5: ")

It doesn't work on a single line, so it will not work
on multiple  lines. Place the cursor inside the word
"InputBox" and press the F1 function key. VBA help reveals
the syntax for InputBox uses only one set  of parenthesis,
not six sets. It also tells how to insert more than one
line, though it omits describing the vbCrLf constant.

Here's a working InputBox.

InputBox ( _
"1 = Underwater Structure" & vbCrLf & _
"2 = Feeding Structure" & vbCrLf & _
"3 = Transfer Structure" & vbCrLf & _
"4 = Fixed Structure" & vbCrLf & _
"5 = Custom Structure" & vbCrLf & vbCrLf & _
"Enter Code 1 thru 5:" _
)

After testing this, I can then place it into the
conditional, confident that an error will not be caused
by the input  box.


If Worksheets("Input").Range("B9").Text = "Stationary" Then
SCTCode = InputBox( _
"1 = Underwater Structure" & vbCrLf & _
"2 = Feeding Structure" & vbCrLf & _
"3 = Transfer Structure" & vbCrLf & _
"4 = Fixed Structure" & vbCrLf & _
"5 = Custom Structure" & vbCrLf & vbCrLf & _
"Enter Code 1 thru 5:" _
)
End If

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Input Box Or get search suggestion and latest updates.


Tagged: