Connecting Tech Pros Worldwide Forums | Help | Site Map

Modify macro to loop through Word table???

Newbie
 
Join Date: Jul 2007
Posts: 1
#1: Jul 31 '07
Hi there, I really hope someone can help with this one. I have a simple recorded macro (code below) which I'm trying to modify. It's for use in MS Word 2003 tables: With the cursor in front of a percentage number in a table cell, I run the macro. It puts the figure in italics and deletes the percentage sign, then tabs to the next cell along ready to do the same again.

What's the best way to get this to loop through the table cells through to the end of the row? Or maybe through the selected parts of the table? The macro would typically not be applied to an entire table, just a couple of rows.

I'm new to editing macros and so far all attempts at getting this to loop have failed. If anyone can suggest a different way - please let me know!

Expand|Select|Wrap|Line Numbers
  1. ..Sub percentage()
  2. '
  3. ' percentage Macro
  4. '
  5.     Selection.Extend
  6.     Selection.Extend
  7.     Selection.Font.Italic = wdToggle
  8.     Selection.MoveRight Unit:=wdCharacter, Count:=1
  9.     Selection.Delete Unit:=wdCharacter, Count:=1
  10.     Selection.MoveRight Unit:=wdCell
  11.     Selection.MoveLeft Unit:=wdCharacter, Count:=1
  12. End Sub
  13. ..
Thank you!

Reply