Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Looping thru TextBoxes

I am trying to get some code to run in a series of textboxes on a
form. I found the bit of code below from Tom Ogilvy which appears
to be able to do that. I put it on a code sheet with Public Sub
LoopthruTextboxes() in front and End Sub at the end and ran it.
The form opens on the screen but nothing else happens. I'm
guessing that cntrl is not a keyword but a variable that needs to
be defined as an object(?) When I get this working would I just put
the code I want to repeat in place of "MsgBox cntrl.Name"?

For Each cntrl In UserForm1.Controls
i = 0
If TypeOf cntrl Is MSForms.TextBox Then
i = i + 1
MsgBox cntrl.Name
End If
Next

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Looping thru TextBoxes

The problem is where you put the code. Put it the UserForm_Click()
event and click on the form when it appears (or have the
UserForm_Click() event call your Sub).

Merjet


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 through textboxes CLamar Excel Discussion (Misc queries) 1 July 12th 06 04:33 PM
tab between several textboxes Kim Excel Worksheet Functions 0 May 9th 05 04:08 PM
sum of textboxes Liedson31 Excel Programming 1 May 3rd 05 06:18 PM
Userform Textboxes and Looping Robbyn Excel Programming 2 March 17th 05 03:07 AM
Textboxes Marcotte A Excel Programming 2 July 7th 04 12:55 AM


All times are GMT +1. The time now is 07:44 PM.

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

About Us

"It's about Microsoft Excel"