Do Loop in table to calculate only when specified

D

Doc60

I am writing a Word Macro that I want to have calculate the value a column of
cellsl only when the value in another cell is > 0. I already have the
calculation setup but need have the macro look at a specific cell to see if
the value in the cell is > 0 and if it is, it should do the calculation in
another in the column of cells. If it is not > 0 then the macro should stop.

Thanks in advance.
 
D

Doug Robbins - Word MVP

Dim check as Range
Set check = ActiveDocument.Tables(Index).Cell(rownum, colnum).Range 'Set
the range to the cell that may contain 0
check.End = check.End - 1 'strip the end of cell marker from the range
If Val(check.Text) = 0 then
'put you calculation code here
End if
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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