View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
skrimpy[_3_] skrimpy[_3_] is offline
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