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.
Bookmarks