Senin, 01 Juli 2013

Vedr: [ExcelVBA] Re: loop with userform

 

Thanks to Dave and Lisa! 

Your advices pointed me in the right direction, but I think I have to do more studies on userforms.

A short question to Dave - in your example how do the user end his input? By closing the userform or with a command button, or else?

I've used VBA mostly to arrange lists of data from medical reports, not collecting data from users.

Yes I want the loop to run 25 times, letting the user give answers on some matrix reasoning tests.

Getting help from you experts is invaluable!

Torstein

________________________________
Fra: Green <1z@compuserve.com>
Til: ExcelVBA@yahoogroups.com
Sendt: Mandag, 1. juli 2013 17.21
Emne: Re: [ExcelVBA] Re: loop with userform


 
Nice Dave... tx.

Torstein... Do you actually want that 25 times loop in there?

Maybe a Do Loop would be better...

Do

' Test the input and if valid Exit Do
' May want to do that if no input is given as well.

Loop

-----Original Message-----
From: dmgathmann <dmgathmann@yahoo.com>
To: ExcelVBA <ExcelVBA@yahoogroups.com>
Sent: Mon, Jul 1, 2013 3:40 am
Subject: [ExcelVBA] Re: loop with userform

Torstein,

To expand somewhat on what Lisa wrote, I've included code for the loop that adds
some user conveniences, such as clearing the textbox and refocusing the cursor
to the textbox.

Sub trythis()
Dim i As Integer
Dim TheEntry As String

For i = 1 To 25
UserForm1.Show
TheEntry = UserForm1.TextBox1.Text
UserForm1.TextBox1.Text = "" 'need to clear the textbox after you've
captured the entry
UserForm1.TextBox1.SetFocus 'puts the focus back in the textbox
Next i
End Sub

Dave Gathmann

--- In ExcelVBA@yahoogroups.com, Torstein Johnsen <sejohnse@...> wrote:
>
> i have a loop with an inputbox
>
> for i = 1 to 25
>
> svar = inputbox("answer?")
>
> next i
>
> I want to replace the inputbox with an userform, which I'm not familiar with.
>
> How can I return from the userform to the loop when the user has written his
answer?
>
> Thank you!
>
> Regards
>
> Torstein
>

------------------------------------

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here:
http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES
for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------Yahoo! Groups Links

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar