Consulting

Results 1 to 1 of 1

Thread: Looking for some help with warehouse Stock replenishment worksheet VBA

  1. #1
    VBAX Newbie
    Joined
    Dec 2012
    Posts
    1
    Location

    Looking for some help with warehouse Stock replenishment worksheet VBA

    Hello Everyone

    I would very appreciate if someone could help me with my problem. I am very new to VBA - this is my first macro.
    What i am creating is stock replenishment spreadsheet. Basically when warehouse boys receive stock they put all the overstock in reverse warehouse. The stock is placed by the delivery date not the item name as we use FIFO method. Every Friday boys replenish stock. What i want them to do is:
    Go on the computer and check type in what they ''need'' stock would be taken from n-10 delivery first, then n-9 delivery ... and then from latest delivery. As they type what they need spreadsheet would also show where the stock is placed . Lets say we have 10 boxes in stock( n-7 delivery 2 boxes , n- 4 6 boxes , n-1 delivery 2 boxes). When I type "need" 5 i would subtract 2 boxes from n-7 delivery and 3 boxes from n-4 delivery and then it would display that 2 boxes been taken from n-7 delivery and 3 boxes been taken from n-4 delivery. This way boys know where to go to get the stock.

    I have written the macro but I have created it only for one item and would like to know what is the best way to cover all the items ( about 400 items). The macro is attached.



    Part of the Code:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Target.Worksheet.Range("d2")) Is Nothing Then

    Dim z2 As Double 'Running total


    ' Column A
    If Worksheets("inputData").Range("a2").Value >= Range("d2").Value Then
    Worksheets("inputData").Range("a2").Value = Worksheets("inputData").Range("a2").Value - Range("d2").Value

    Range("e1:z1,e2:z2").ClearContents
    Worksheets("inputData").Range("a1").Copy Range("e1")
    Range("e2").Value = Range("d2").Value
    Else
    z2 = Worksheets("inputData").Range("a2") + Worksheets("inputData").Range("b2")

    'Column B
    If Worksheets("inputData").Range("a2").Value < Range("d2").Value And z2 >= Range("d2").Value Then
    Worksheets("inputData").Range("b2").Value = z2 - Range("d2")
    If Worksheets("inputData").Range("a2").Value >= 0 Then
    Range("e1:z1,e2:z2").ClearContents
    Worksheets("inputData").Range("a1:b1").Copy Range("e1:f2")
    Range("e2").Cells.Value = Worksheets("inputData").Range("a2").Cells.Value
    Range("f2").Cells.Value = Range("d2") - Range("e2").Value
    End If
    Worksheets("inputData").Range("a2").Value = 0
    Else
    z2 = z2 + Worksheets("inputData").Range("c2").Value
    Attached Files Attached Files

Posting Permissions

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