LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Looping through TextBoxes

If you're in the userform_initialize event (or anywhere in the userform module),
you could use:

With Me
(instead of With Userform1)

so

dim iCtr as long
for ictr = 1 to 13 'lbound(myArray) to ubound(myArray)
me.controls("txbox" & ictr).value = myarray(ictr)
next ictr

The names and array bounds have to be in sync.

Al_82 wrote:

I have a UserForm with an array of TextBoxes that allows the user to edit
selected data arrays from a larger database. To load these TextBoxes I can
use a brute force method:

With UserForm1
.txBox1 = array(1)
.txBox2 = array(2)
etc

but it would obviously be better to do this in a loop. My problem is I
cant figure how to synthesize the TextBox names so I can use a loop to
functionally do:

.txBoxn= array(n)
Can someone tell me how to do this?

--
Al_82


--

Dave Peterson
 
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
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them RyanH Excel Programming 3 November 19th 07 03:30 PM
Looping thru TextBoxes John Pierce Excel Programming 1 March 8th 07 05:32 PM
Looping through textboxes CLamar Excel Discussion (Misc queries) 1 July 12th 06 04:33 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


All times are GMT +1. The time now is 02:17 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"