Minggu, 30 Juni 2013

[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
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
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