Selasa, 02 Juli 2013

Re: Vedr: [ExcelVBA] Re: loop with userform

 

I'm confused. 

Torstein, please tell me exactly what are you trying to do.

Derek Turner +++

>________________________________
> From: dmgathmann <dmgathmann@yahoo.com>
>To: ExcelVBA@yahoogroups.com
>Sent: Tuesday, 2 July 2013, 18:17
>Subject: Vedr: [ExcelVBA] Re: loop with userform
>
>
>

>Torstein,
>
>I gave the form two command buttons, cbOK and cbClear. The code for the buttons follows:
>
>Private Sub cbClear_Click()
>Me.TextBox1.Text = ""
>Me.TextBox1.SetFocus
>End Sub
>
>Private Sub cbOK_Click()
>Me.Hide
>End Sub
>
>By the user clicking the cbOK button, the form is hidden and control is passed back to the loop from which the form was called; so the code following the UserForm1.Show is then executed. Assuming that a lot of computing time is not required to the end of the For Next loop, the form never appears to be hidden to the user.
>
>Also, as Lisa alludes to, depending on what types of input you are looking for (numbers vs free flowing text), you may need to do some parsing of the input to make sure the rest of the loop handles it appropriately.
>
>Dave Gathmann
>
>--- In ExcelVBA@yahoogroups.com, Torstein Johnsen <sejohnse@...> wrote:
>>
>> 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@...>
>> 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@...>
>> 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]
>>
>
>
>
>
>

[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 (9)
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