Hi All,
How does one put a hyphen in all empty cells in a table?
tia
Gil
Some of my efforts are:
Sub a1()
'
' a1 macro
'
'
Selection.MoveRight Unit:=wdCell
Dim MyVar, MyCheck
MyCheck = IsNull(MyVar) ' Returns False.
'MyVar = ""
'MyCheck = IsNull(MyVar) ' Returns False.'
'MyVar = Null
'MyCheck = IsNull(MyVar) ' Returns True.
MyVar = Selection.Text
If MyCheck = IsNull(MyVar) = True Then
Selection.TypeText Text:="-"
ElseIf MyCheck = IsNull(MyVar) = False Then
' End If
' If MyVar = Null Then
' Selection.TypeText Text:="-"
' ElseIf MyCheck = False Then
' End If
End If
End Sub
Helmut Weber - 13 Feb 2005 22:33 GMT
Hi Gil,
for the first table that is touched by the selection:
Dim c As Cell
For Each c In Selection.Tables(1).Range.Cells
If Len(c.Range.Text) = 2 Then
c.Range.Text = "-"
End If
Next
There may be faster ways, though,
but not many, probably.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Jezebel - 13 Feb 2005 22:36 GMT
Don't understand your code at all, but perhaps what's throwing you off is
that every cell -- including empty cells -- contains a minimum of two
characters: chr(13)chr(7).
Dim pCell as Word.Cell
pCell = Selection.Tables(1).Cell(1,1)
Do
If len(pCell.Range) = 2 then
pCell.Range = "-"
end if
set pCell = pCell.Next
Loop until pCell is nothing
> Hi All,
>
[quoted text clipped - 33 lines]
> End If
> End Sub
Gil Carter - 13 Feb 2005 22:43 GMT
Whoaah!
REALly fine, .... and SOOO fast.
Thans a Mil to you both!
:)
Gil
> Don't understand your code at all, but perhaps what's throwing you off is
> that every cell -- including empty cells -- contains a minimum of two
[quoted text clipped - 46 lines]
>> End If
>> End Sub