ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   LOOP HELP! (https://www.excelbanter.com/excel-programming/427973-loop-help.html)

DarrenL

LOOP HELP!
 
I am trying to create a loop in which it will ask the same questions to the
user repeatedly until the user opts out. However, I need to be able to
reference the answers to all of their questions each time they go through the
loop. How do assign a variable when they will change each time and be
differrent for each question they are asked? example: color type size
continue? color type size continue? loop---------and have all of those
answers accessible. Not just the last one. Thanks
D

edward

LOOP HELP!
 
You can use an array variable and if the size is variable you can use the
combination of Redim Preserve
something like

Sub readInput()
Dim i As Long
Dim myarray()

Do While <---- some boolean to check
ReDim Preserve myarray(i)
myarray(i) = MsgBox("your question", vbYesNoCancel)
i = i + 1
Loop


End Sub
--
Best regards,
Edward


"DarrenL" wrote:

I am trying to create a loop in which it will ask the same questions to the
user repeatedly until the user opts out. However, I need to be able to
reference the answers to all of their questions each time they go through the
loop. How do assign a variable when they will change each time and be
differrent for each question they are asked? example: color type size
continue? color type size continue? loop---------and have all of those
answers accessible. Not just the last one. Thanks
D



All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com