D
Dustin I
Thanks Peter for help with my previous post.
Ok, I have this code below, however it doesn't seem to
recognize when there is an empty cell. I have tried
using cell <> "" and I get the same result. It seems to
think there is something in the cell. I only want the
code to execute if it finds a value in xCell. I have
also tried Val(cellref).text <>.
Any suggestion?
' Declarations
Dim qty As Cell
Dim prc As Cell
Dim extPrc As Cell
Dim ttl As Long
Dim tbl As Table
' Initialization
Set tbl = ActiveDocument.Tables(2)
For i = 2 To tbl.Rows.Count
Set qty = tbl.Cell(Row:=i, Column:=2)
Set prc = tbl.Cell(Row:=i, Column:=4)
Set extPrc = tbl.Cell(Row:=i, Column:=5)
If Val(prc.Range.Text) <> Null Then
ttl = Val(qty.Range.Text) * Val(prc.Range.Text)
extPrc.Range.Text = ttl
Else
extPrc.Range.Text = ""
End If
Next
Ok, I have this code below, however it doesn't seem to
recognize when there is an empty cell. I have tried
using cell <> "" and I get the same result. It seems to
think there is something in the cell. I only want the
code to execute if it finds a value in xCell. I have
also tried Val(cellref).text <>.
Any suggestion?
' Declarations
Dim qty As Cell
Dim prc As Cell
Dim extPrc As Cell
Dim ttl As Long
Dim tbl As Table
' Initialization
Set tbl = ActiveDocument.Tables(2)
For i = 2 To tbl.Rows.Count
Set qty = tbl.Cell(Row:=i, Column:=2)
Set prc = tbl.Cell(Row:=i, Column:=4)
Set extPrc = tbl.Cell(Row:=i, Column:=5)
If Val(prc.Range.Text) <> Null Then
ttl = Val(qty.Range.Text) * Val(prc.Range.Text)
extPrc.Range.Text = ttl
Else
extPrc.Range.Text = ""
End If
Next