View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default No clue whatsoever, so thought I'd ask the experts

The 'o' worked because you do not have an Option Explicit statement
protecting you from typing in undeclared variables; so VB simply created a
Variant variable named 'o' and, since it was being used in a context
requiring a counter, coerced it to an Integer (or perhaps a Double... not
positive about that) and used the default value of a newly declared numeric
variable which is '0' (zero).

--
Rick (MVP - Excel)


"Paul" wrote in message
...
Weirdly enough Susan, "o" worked too lol

"Susan" wrote:

TYPO ALERT

For i = 0 To 2

that's a zero, not a letter o.

:)
susan


On Jan 27, 10:15 am, Gary''s Student
wrote:
How about:

Sub AskMeNoQuestions()
Dim s(3)
s(0) = "What is the meaning of life?"
s(1) = "How many neutrinos are there in the universe?"
s(2) = "Why are the key pads on phones and computer keyboards
different?"
For i = o To 2
x = Application.InputBox(prompt:=s(i), Type:=2)
j = i + 1
Cells(j, 1).Value = s(i)
Cells(j, 2).Value = x
Next
End Sub
--
Gary''s Student - gsnu200829



"Paul" wrote:
Many years ago a colleague of mine created a program (or I think it
was some
sort of VBA?) when I opened Excel (or Word) where a window would pop
up,
asking me a question, to which I woudl type the data/answer. After
all the
questions were answered, the program finished, then it put the data
into
specific cells/tables...I found it fascinating but never knew how it
was done.

I have a spreadsheet with a column of data, which is generally a
title of a
topic or a question. To the right of the data is the answer to the
left
column.

Simply put, if I had : -

Cell A1 as "What is your name", then Cell B1 would be "Paul"
Cell A2 as "Where do you live", then Cell B2 would be "England"

...etc, etc until all my Cells/Lines are complete.

Now...what I would like to do is use a "looping" program (if there is
such
thing) to prompt a window to pop up (like a Userform) with a Label
"What is
your Name" and a Text Box so I can type the answer "Paul".

I then want this to loop over and over again, so maybe a "Next"
Command
Button needs to be there (and maybe, Previous, Close etc), this then
prompts
the next question "Where do you live", which will input the data
"England" on
the next line and so on and so on.

How would this be done?

Hope I've explained it OK. Hope you can help

Regards
Paul- Hide quoted text -

- Show quoted text -