Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help looping through textboxs on userform


hi

I have a userform which has labels,comboboxes, textboxes and
commandbutton.

I have 10 textboxes which are names from textbox1 through to textbox10
is there a way to loop through these. What I want to do is when the
user clicks cancel button it will clear all the values which they have
entered in to textbox 1-10 and then hide the userform.

i tried something like this

'For Each Item In frmmanualentry.Controls '.Item
'
'Item.Value = ""

'Next Item

the problem is it does through all the comboboxes,labels and anythign
on the userform and changes them to blank values.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544219

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default help looping through textboxs on userform

Hi,

you can add into your loop check for textbox

For Each Item In frmmanualentry.Controls
if item.name like "textbox*" then
item.value = ""
end if
next item

Regards,
Ivan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help looping through textboxs on userform


thanks for the suggestion i tried that but when i step through the code
and I move my mouse over the word Item on the line "FOR each ...." item
is coming up as the value of the textbox,combobox,label etc. so it does
not seem to register it and clear the value.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544219

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default help looping through textboxs on userform

Dim ix As Integer
For ix = 1 To 10
Me.Controls("Textbox" & ix).Value = ""
Next

--
Cheers
Nigel



"funkymonkUK"
wrote in message
...

hi

I have a userform which has labels,comboboxes, textboxes and
commandbutton.

I have 10 textboxes which are names from textbox1 through to textbox10
is there a way to loop through these. What I want to do is when the
user clicks cancel button it will clear all the values which they have
entered in to textbox 1-10 and then hide the userform.

i tried something like this

'For Each Item In frmmanualentry.Controls '.Item
'
'Item.Value = ""

'Next Item

the problem is it does through all the comboboxes,labels and anythign
on the userform and changes them to blank values.


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile:
http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544219



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help looping through textboxs on userform


Thank Nigel.


I think I should KICK myself right now. I see where I was going wrong I
forgot although the it was a textbox the control had a name which was
textbox if the textbox.name was cat then i would have had top have
"cat" & i




thanks man


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=544219

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Userform Textboxes and Looping Robbyn Excel Programming 2 March 17th 05 03:07 AM
Problem with looping through userform controls Jeremy Gollehon[_2_] Excel Programming 5 February 17th 05 05:41 PM
looping through userform controls JulieD Excel Programming 2 August 14th 04 02:13 PM
looping through all checkbox's in a userform strataguru[_3_] Excel Programming 1 October 7th 03 05:01 PM


All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"