Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default textbox array

Hi all,

I remember that there is a setting in property window to make all the
textbox in an array, but not found in excel 2003 VBA, need to write code?

thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default textbox array

One can make control array in VB (each control has the same name and
an index, and Index is a Property). Excel VBA (2003 at least) does not
offer this.

You can loop through all Textboxes on a UserForm like this:

For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
Debug.Print c.Name
'do something else
End If
Next c
End Sub

Hth,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default textbox array

Thanks...but how to group them into an array?
How to code in the 'do something else ?

"merjet"
egroups.com...
One can make control array in VB (each control has the same name and
an index, and Index is a Property). Excel VBA (2003 at least) does not
offer this.

You can loop through all Textboxes on a UserForm like this:

For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
Debug.Print c.Name
'do something else
End If
Next c
End Sub

Hth,
Merjet




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default textbox array

Thanks...but how to group them into an array?

They are in the Controls collection already. If you want them in an
array, you will have to build it youself.

How to code in the 'do something else ?


I don't know what you are trying to do or why you want them in an
array.

Merjet

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default textbox array

ic..I just want to get every textbox value and perform some calculation then
put the result in some cells. How to get the value of those textbox in the
controls collection?

"merjet"
groups.com...
Thanks...but how to group them into an array?


They are in the Controls collection already. If you want them in an
array, you will have to build it youself.

How to code in the 'do something else ?


I don't know what you are trying to do or why you want them in an
array.

Merjet





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default textbox array

ic..I just want to get every textbox value and perform some calculation then
put the result in some cells. How to get the value of those textbox in the
controls collection?


For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
Debug.Print c.Value ' or c.Text
z = c.Value 'assign to variable
End If
Next c

c.Value is String, so convert or assign to a numeric variable to do
calcs.

Merjet




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default textbox array

Thanks
How do it define the sequence of textboxes? By the last number of its name?
"merjet"
egroups.com...
ic..I just want to get every textbox value and perform some calculation
then
put the result in some cells. How to get the value of those textbox in
the
controls collection?


For Each c In Me.Controls
If TypeName(c) = "TextBox" Then
Debug.Print c.Value ' or c.Text
z = c.Value 'assign to variable
End If
Next c

c.Value is String, so convert or assign to a numeric variable to do
calcs.

Merjet






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default textbox array

How do it define the sequence of textboxes? By the last number of its name?

Yes, if you accepted the default names Textbox1, Textbox2, etc.

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
Set Textbox value = large(ARRAY,k) BlueWolverine Charts and Charting in Excel 1 July 29th 09 05:03 PM
Array of values in 1 textbox Justin[_15_] Excel Programming 4 November 30th 06 01:49 AM
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM


All times are GMT +1. The time now is 09:28 AM.

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"