move cursor to beginning of the previous word

J

jenn

I want to write a macro to insert a tab at the beginning of each word as I move down the column. How I can get the cursor to move to the beginning of the word... ? I know theres a short cut...
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < jenn > écrivait :
In this message, < jenn > wrote:

|| I want to write a macro to insert a tab at the beginning of each word as
I move down the column.
|| How I can get the cursor to move to the beginning of the word... ? I know
theres a short cut...

Try this

'_______________________________________
Sub AddTab()

Dim WordRange As Range
Dim WdCell As Cell

With Selection.Tables(1)

For Each WdCell In .Columns(1).Cells
Set WordRange = WdCell.Range.Words(1)
WordRange.InsertBefore vbTab
Next WdCell

End With

Set WordRange = Nothing

End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jezebel

Ctrl-LeftArrow



jenn said:
I want to write a macro to insert a tab at the beginning of each word as I
move down the column. How I can get the cursor to move to the beginning of
the word... ? I know theres a short cut...
 

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