Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jul 2003
    Location
    USA
    Posts
    728
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Enter 0 in cell via Macro (Word 97)

    Looking for a macro that will enter 0 (a zero) in every empty cell. Is there one around? Thanks much.
    (Word97)
    ACM

  2. #2
    Star Lounger
    Join Date
    Dec 2000
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enter 0 in cell via Macro (Word 97)

    Try this snippet of code. This should do the trick for you:

    Dim aTable As Table
    Dim aCell As Cell
    Dim CellRange As Range

    For Each aTable In ActiveDocument.Tables
    For Each aCell In aTable.Range.Cells
    Set CellRange = aCell.Range
    CellRange.MoveEnd Unit:=wdCharacter, Count:=-1
    'Check to see if cell is empty, if so insert a "0"
    If CellRange.Text = "" Then
    CellRange.InsertAfter Text:="0"
    End If
    Next aCell
    Next aTable

    Best regards,

    Stephan

  3. #3
    5 Star Lounger
    Join Date
    Jul 2003
    Location
    USA
    Posts
    728
    Thanks
    7
    Thanked 2 Times in 2 Posts

    Re: Enter 0 in cell via Macro (Word 97)

    Stephan -

    Terrific!!!!!!!!Thanks so much for sending the code and for your quickness in so doing.

    ACM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •