View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default looping and objects

One way:

Dim i As Long
For i = 1 to ActiveSheet.Textboxes.Count
ActiveSheet.Textboxes(i).Text = "test"
Next i


Another:

Dim tbTemp As TextBox
For Each tbTemp In ActiveSheet.TextBoxes
tbTemp.Text = "test"
Next tbTemp


In article ,
"Rune" wrote:

I'm a newbie and have this problem:

I have 13 textboxes called MN1, MN2, MN3 ...... MN13
when trying to set text in all of them i did this:

for i 1 to 13
Dim Temp as object
Set Temp = "MN" & i
temp.text = "test"
next i

How do i refer to an object whith i in a loop??