Results 1 to 3 of 3

Thread: Problem with 2 loop in VBA

  1. #1

    Problem with 2 loop in VBA

    Register for a FREE account, and/
    or Log in to avoid these ads!

    hi everyone

    I have problem with loop in vba. I have 2 loop:
    loop 1) run from b2 to b17.value in this loop run loop 2
    loop 2) run from Bj to Fj (j from 1 to 5), if duplucate goto next, else "/drug name"
    Attached Files Attached Files

  2. #2
    Magician Hercules1946's Avatar
    Join Date
    Mar 2013
    York, England
    Excel Version
    I'm not sure what your expected outcome is, but I can see two problems with the code:

    1) Your attempting to assign a value to e string variable sText, but there is nothing after the equals sign, so this is an invalid statement.
    2) In your J loop, you reference the cell value at (I,j), but you are not assigning any value to the cell, or performing any action with the cell value, which is a fatal error (run time 438).

  3. #3
    Magician NoS's Avatar
    Join Date
    Jan 2013
    British Columbia
    Excel Version
    Excel 2010
    Copied your Sheet 1 to a new sheet and changed your blank cells from 0 to blanks.
    What you have on row 8 indicates r and R are considered equal.
    Believe this does what you want, the results are written to column J.

Posting Permissions

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