View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
vezerid
 
Posts: n/a
Default Spreadsheet prompting for information

What kind of error? Where did you paste it? When is the error produced?

I just saw an error in my code, change Sheet("Answers") to
Sheets("Answers"). Maybe this causes it? Did this line get yellow?

To handle multiple asnwers to be stored in a table I suggest you
actually create a sheet Answers. Put headers in the first row,
indicative of the parameter answered with each input box. Then use two
different pieces of code, one for the first reply in each new open and
the other (with modifications) for all other answers of each user.

The code snippet for the first answer (which creates a new row):

Private Sub Workbook_Open()
' Code for first answer in a new Open
Msg1 = "Please enter 1ST ANSWER"
Val1 = InputBox(Msg1)
If Val1 < vbCancel Then
r = Sheets("Answers").Range("A65536").End(xlUp).Row+1
Sheets("Answers").Range("A" & r) = Val1
End If

'Code for subsequent answers in the same Open
Msg2 = "Please enter 2ND ANSWER"
Val2 = InputBox(Msg2)
If Val2 < vbCancel Then
Sheets("Answers").Range("B" & r) = Val1
End If

End Sub

Note in the above code that the second snippet needs to be edited and
reused further down the routine. Do not forget to change the letter in
each answer -- Range("B" & r)

This whole thing could be written in a much more elegant way but it
should still do your job.

Does this help now?
Kostis Vezerides