Anyone,
How can I modify the following macro to repeat the action 20 times?
TIA,
Jerry Porter
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 6/15/2005 by gerald.porter
'
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
End Sub
Chuck - 15 Jun 2005 14:37 GMT
Check out the following in VBA help:
For...Next statement
For Each...Next statement
Do...Loop statement
While...Wend statement
Your code would need the following:
Dim x as Long
For x = 1 to 20
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=vbTab
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Next x
> Anyone,
>
[quoted text clipped - 14 lines]
>
> End Sub