+ Reply to Thread
Results 1 to 2 of 2

Calculation loop through col and rows.

  1. #1
    Registered User
    Join Date
    08-30-2010
    Location
    madagascar
    MS-Off Ver
    Excel 2003
    Posts
    1

    Calculation loop through col and rows.

    Hi all,

    I have a file which I have placed vba code but it seems I have wrongly defined and cannot figure what is wrong. Actually the code is running but do not place the value on the loading zone defined. See my attached file for better understanding.

    Well it consist of a loading file which I used to plan items.

    There is cap limit for each item and a cap limit for each cell.

    E.g for item A the cap limit is 250 and the Qty is 1300 plan to work in cell 201. therefore it will have to place 250 but depending from the cap available for cell 201 on starting from col F to col J and the balance of 50 in col K.

    This have to loop through the col and rows until all the item have been plan.
    Please can anyone see the codes for me and advise where it have wrongly done. As I already stuck with this till long.

    see also the code here:
    Sub tester()

    pos_column = Range("factory_pos_column").Column
    loading_row_start = Range("loading_header_row").Row + 1
    If Range("Main!A1").Offset(loading_row_start - 1, pos_column - 1) = "" Then
    MsgBox ("empty")
    Exit Sub
    End If

    'compute loading size

    loading_column_start = Range("loading_zones").Column
    loading_column_end = Range("loading_zones").Column + Range("loading_zones").Columns.Count - 1

    'find min and max loading
    loading_row_start = Range("loading_zones").Row
    loading_row_end = Range("main!A65536").Offset(0, pos_column - 1).End(xlUp).Row

    loading_row_count = loading_row_end - loading_row_start + 1

    ' update_quantum = WorksheetFunction.Round(0.02 * loading_row_count, 0)
    ' update_counter = 0

    For loading_row = loading_row_start To loading_row_end



    cummulative_output = 0

    For loading_column = loading_column_start To loading_column_end

    balance_to_load_day = 0

    If factory_pos_column <> "" Then

    Do

    balance_to_load_day = balance_to_load + Range("main!A1").Offset(loading_row - 1, loading_column - 5).Value

    Loop Until balance_to_load_day = 0
    End If


    Next loading_column
    Next loading_row

    End Sub



    Many thanks in advance for the help.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Calculation loop through col and rows.

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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