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


I am in the process of equating values between an interface containing
many text boxes to cells that do a bunch of number crunching(ie 26
cells to 26 text boxes). I started by using 26 variables corresponding
to the data that was going back and forth through the text boxes and
their corresponding cells. I assume this is a very crude and most
likely incorrect method. Especially since it didn't work. Therefore,
I have written the below loop. Is there a way to name the text box, in
this case "t1" so that I can increment to the next set in the series
"t3" to apply the same code to the next text box and corresponding cell
in the sequence? Of course I realize that my nomenclature is not quite
"correct" and that I would have to also incremement variables a and b.
Thanks in advance to anyone that might help.
Private Sub cmdCalculate_Click()
Dim Counter As Integer
Dim a As Byte
Dim b As Byte
Dim c As String
Dim d As String
Worksheets("2 Parents").Activate
Counter = 0
a = 9
b = 3
c = Cells(b, a)
Do
If c = "n/a" Then
t1 = ActiveSheet.Cells(b, a - 1)
Else: t1 = ActiveSheet.Cells(b, a - 1) & "," & ActiveSheet.Cells(b,
a)
End If
Counter = Counter + 1
b = b + 1
Loop Until Counter = 1
End Sub


--
skrimpy
------------------------------------------------------------------------
skrimpy's Profile: http://www.excelforum.com/member.php...o&userid=14634
View this thread: http://www.excelforum.com/showthread...hreadid=263461

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Looping through text boxes

Assume interface means Userform.

Private Sub cmdCalculate_Click()
Dim Counter As Integer
Dim a As Byte
Dim b As Byte
Dim c As String
Dim d As String
Worksheets("2 Parents").Activate
for j = 1 to 2*26 step 2
Counter = 0
a = 9
b = 3
c = Cells(b, a)
Do
If c = "n/a" Then
Userform1.Controls("t" & j).Value = _
ActiveSheet.Cells(b, a - 1)
Else
Userform1.Controls("t" & j).Value = _
ActiveSheet.Cells(b, a - 1) & "," & ActiveSheet.Cells(b,a)
End If
Counter = Counter + 1
b = b + 1
Loop Until Counter = 1
End Sub

might give you some ideas. I don't know what the interaction/relationship is
between b and a and each textbox, so you will have to figure that out.

--
Regards,
Tom Ogilvy

"skrimpy" wrote in message
...

I am in the process of equating values between an interface containing
many text boxes to cells that do a bunch of number crunching(ie 26
cells to 26 text boxes). I started by using 26 variables corresponding
to the data that was going back and forth through the text boxes and
their corresponding cells. I assume this is a very crude and most
likely incorrect method. Especially since it didn't work. Therefore,
I have written the below loop. Is there a way to name the text box, in
this case "t1" so that I can increment to the next set in the series
"t3" to apply the same code to the next text box and corresponding cell
in the sequence? Of course I realize that my nomenclature is not quite
"correct" and that I would have to also incremement variables a and b.
Thanks in advance to anyone that might help.
Private Sub cmdCalculate_Click()
Dim Counter As Integer
Dim a As Byte
Dim b As Byte
Dim c As String
Dim d As String
Worksheets("2 Parents").Activate
Counter = 0
a = 9
b = 3
c = Cells(b, a)
Do
If c = "n/a" Then
t1 = ActiveSheet.Cells(b, a - 1)
Else: t1 = ActiveSheet.Cells(b, a - 1) & "," & ActiveSheet.Cells(b,
a)
End If
Counter = Counter + 1
b = b + 1
Loop Until Counter = 1
End Sub


--
skrimpy
------------------------------------------------------------------------
skrimpy's Profile:

http://www.excelforum.com/member.php...o&userid=14634
View this thread: http://www.excelforum.com/showthread...hreadid=263461



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
User Form Text Boxes - Copy format of text boxes NDBC Excel Discussion (Misc queries) 3 July 2nd 09 02:02 AM
Looping through text Fish Excel Programming 1 September 21st 04 02:43 PM
Looping Text Bob Myles Excel Programming 4 April 25th 04 04:36 AM
looping through text boxes Ian Mangelsdorf Excel Programming 1 January 20th 04 06:11 AM
Looping through Text boxes Fred[_9_] Excel Programming 0 July 9th 03 03:06 AM


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