Hello everybody! I want to loop through a worksheet which contains inserted TextBoxes.
However, the "name" of TextBoxes don't follow each other in a logical way (not 1,2,3..., 100 and so on) It shows sometimes some skipp: 2-3-4, 6-7-8, 10-11-12 because of the paste)
I try to skipp the textbox if it doesn't exist. For example TextBox 1 doesn't exist, but 2-3 and 4 exist.
Why cant my code skip "Textbox 1"? It accepts it if it would exist.
Thank you very much for your help, it means a lot to me! Have a nice day!
However, the "name" of TextBoxes don't follow each other in a logical way (not 1,2,3..., 100 and so on) It shows sometimes some skipp: 2-3-4, 6-7-8, 10-11-12 because of the paste)
I try to skipp the textbox if it doesn't exist. For example TextBox 1 doesn't exist, but 2-3 and 4 exist.
Why cant my code skip "Textbox 1"? It accepts it if it would exist.
Thank you very much for your help, it means a lot to me! Have a nice day!
Code:
sub test()
[B]
For i = 1 To 1000 Step 1 [/B]
On Error Resume Next
[B]If[/B] IsNull(ActiveSheet.Shapes("TextBox " & i)) = False Then [B][COLOR=#008000]'Textbox 1 doesn't exist, but code doesn't skips here. Why?[/COLOR][/B]
k=k+1
ActiveSheet.Shapes("TextBox " & i).TextFrame.Characters.Text = Worksheets("2").Cells(k, "A").Value
[B]end if[/B]
[B]next
[/B]
end sub