Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Loop through textboxes on a userform?!

Hello,

I have a userform that has over 30 textboxes. I need to check the database
and if a certain value is returned that matches a particular textbox, I need
to turn the backcolor to blue.

How do I loop through all the textboxes on a userform?

Here is the pseudo code of what I am trying to do:


For i=1 to userform.controls
if control.i.typename = " LISTBOX" then
if left(control.i.name,5) = "table" then
CheckFlag = CheckTable(control.i.name)
if CheckFlag then
control.i.backcolor = Green
end if
end if
end if
next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Loop through textboxes on a userform?!

something like this should do what you want.

Dim ctl As Control

For Each ctl In UserForm1.Controls

If TypeName(ctl) = "TextBox" Then

'do you stuff here

End If

Next
--
jb


"Webtechie" wrote:

Hello,

I have a userform that has over 30 textboxes. I need to check the database
and if a certain value is returned that matches a particular textbox, I need
to turn the backcolor to blue.

How do I loop through all the textboxes on a userform?

Here is the pseudo code of what I am trying to do:


For i=1 to userform.controls
if control.i.typename = " LISTBOX" then
if left(control.i.name,5) = "table" then
CheckFlag = CheckTable(control.i.name)
if CheckFlag then
control.i.backcolor = Green
end if
end if
end if
next

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Loop through textboxes on a userform?!

Thanks!!

"john" wrote:

something like this should do what you want.

Dim ctl As Control

For Each ctl In UserForm1.Controls

If TypeName(ctl) = "TextBox" Then

'do you stuff here

End If

Next
--
jb


"Webtechie" wrote:

Hello,

I have a userform that has over 30 textboxes. I need to check the database
and if a certain value is returned that matches a particular textbox, I need
to turn the backcolor to blue.

How do I loop through all the textboxes on a userform?

Here is the pseudo code of what I am trying to do:


For i=1 to userform.controls
if control.i.typename = " LISTBOX" then
if left(control.i.name,5) = "table" then
CheckFlag = CheckTable(control.i.name)
if CheckFlag then
control.i.backcolor = Green
end if
end if
end if
next

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
Need a macro to loop evaluation of many textboxes in a UserForm. excelnut1954 Excel Programming 6 April 25th 06 03:26 AM
UserForm TextBoxes Rob Excel Discussion (Misc queries) 2 August 6th 05 03:07 AM
loop through textboxes only marwan hefnawy Excel Programming 1 May 21st 04 06:59 AM
userform textboxes again Jo[_6_] Excel Programming 4 October 21st 03 07:25 PM
userform textboxes Jo[_6_] Excel Programming 4 October 21st 03 07:15 PM


All times are GMT +1. The time now is 11:21 AM.

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"