Results 1 to 6 of 6

Thread: check cells before division by zero

Threaded View

  1. #1

    Thread Starter
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    check cells before division by zero

    I want to make sure of no divison by zero error messages
    I am doing division on a mshflexgrid like this:
    with grid
    .textmatrix(2, 12) = .textmatrix(2, 11) / .textmatrix(2, 9)
    some of the cells maybe empty and some maybe formated as currency with a dollar sign
    is this the best method:
    vb Code:
    1. If val(.textmatrix(2, 11) <> 0 then
    2.       If val(.textmatrix(2, 9) <> 0 then
    3.              .textmatrix(2, 12) = .textmatrix(2, 11) / .textmatrix(2, 9)
    4.       else
    5.              textmatrix(2, 12) = ""
    6.       end if
    7. end if
    would this code be appropriate?
    Last edited by Hack; Mar 8th, 2007 at 02:48 PM. Reason: Added VB Highlight Tags and Indenting

Posting Permissions

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



Click Here to Expand Forum to Full Width