How Do I......

J

Jerry

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
 
C

Chuck

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top