+ Reply to Thread
Results 1 to 5 of 5

How to use Loop and If to return value

  1. #1
    Registered User
    Join Date
    07-06-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    45

    How to use Loop and If to return value

    Hi,
    I need a VBA to return "NA" for column I if it is error, the code used were evaluate and add (show in attachment). And to return value to column J, if I2 = NA then"NA"; I3=0 then "Remain"; I4=-1 then "Improved"; I5=-2 then "Excellent"; I6=1 then "Drop"; I7=2 then "worst". And return value in next cell of column "K", for every row checked as "checked".

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How to use Loop and If to return value

    Try this,
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-06-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: How to use Loop and If to return value

    Hi Dave,
    Thanks for the help, but it just giving me the result of column H. How if I wanted the result at column J if it is "improve", "remain" or "worst etc in column J, and indicate the line as checked when it run through, as this will be run periodically.
    The lines checked, will not be running again in next run. I tried following, but it's only works for column K, as all checked, but no result on column J.

    Please Login or Register  to view this content.
    [/QUOTE]

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How to use Loop and If to return value

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-06-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: How to use Loop and If to return value

    Hi Dave,
    Thank you for the great help. May the good merits of this works transmit to you.Merry X'mas.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to loop through a column and return non duplicates?
    By ip916a4bb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2013, 04:59 PM
  2. Return a single message box within a loop.
    By aappmm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2012, 12:48 PM
  3. Loop through column and return value
    By Hond70 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2011, 12:35 PM
  4. loop thru 3 cells in a row, return value in 4th cell
    By melbri in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2010, 03:26 PM
  5. Loop through VBA Forms and return names
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2009, 08:59 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1