Macro Loop


Joined
Jan 23, 2023
Messages
1
Reaction score
0
I need to loop a simple macro. I was successful using "Chain" for years until everything changed I reckon. I know squat about vb.
I have many similar lines. I recorded a macro that edits the line of text and drops to the beginning of the next line.
Now i want that to repeat until the end of the doc.
I believe it is the Loop. I searched a read many articles but it isn't clear to me. Should be easy I think.
the name of the macro is csv and is below. I have tried the Loop, Do Loop. The debug doesn't help, nor the help when i get the syntax error.
Anyone that will help I appreciate it.

Sub csv()
'
' csv Macro
'
'
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=1
Selection.TypeText Text:=","
Selection.MoveRight Unit:=wdWord, Count:=3
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
 
Ad

Advertisements


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

Top