Results 1 to 27 of 27

VBA loop to multiply by negative one

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-15-2013
    Location
    New York, NY
    MS-Off Ver
    Excel 2010
    Posts
    129

    VBA loop to multiply by negative one

    Hi guys

    I'm looking for a VBA code that does a type of multiply loop. Take a look at the sheet. The goal is: if one of the numbers in column A:A is greater than zero, the NEXT five numbers in the column L:L should be multiplied by negative one, and outputted in Y:Y. If the number in column A:A is less than zero the next five numbers in the L:L should just be outputted in Y:Y (not multiplied by negative 1). If there's no number or an N/A, the loop should just ignore these cells. The should be done with every pair (A&L, B&M, C&N, ect).

    So for example, the loop will run and find a A2 populated with a negative number, so it would output L3:L7 into Y3:Y7. The loop would then start again at A8, find A12 populated with a negative number, and then output L13:L17 into Y13:L17. When the loop runs again, it will find a positive number in A:20, and will therefore multiply L21:L25 by negative one and output that into Y21:Y25. This should happen with B&M, C&N, ect

    Hope I'm being clear! Any help is really appreciated!
    Attached Files Attached Files
    Last edited by mkeys4; 08-14-2013 at 01:24 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] If cell is negative multiply by -1 formula
    By thelegazy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-16-2013, 11:36 AM
  2. [SOLVED] VBA Loop to check range for Negative number
    By Zarley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2013, 01:58 PM
  3. If criteria match, multiply then sum across multiply worksheets
    By ciayers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2013, 02:20 PM
  4. Macro Loop until Negative number is reached and perform an interpolation
    By anaessens in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2012, 09:54 AM
  5. [SOLVED] Trying to execute function after negative if conditional nested in For each loop
    By Red in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2006, 04:20 PM

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