Senin, 01 Juli 2013

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]

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