Results 1 to 6 of 6

Forecast KIT splitting based on BOM list

Threaded View

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    Sárvár, Hungary
    MS-Off Ver
    2007
    Posts
    5

    Forecast KIT splitting based on BOM list

    Hi All,

    I'm not familiar with Excel VBA macros...

    I have a forecast sheet (Sheet1) and a BOM list other sheet (Sheet2).
    The forecast sheet contains the item codes in the first (A) column and the forecasted quantity by week per column.
    The BOM list sheet contains the KIT item code in the first (A) column, KIT description in column B , Component code in column C and Component description in column D.
    The forecast item codes contains simple products and kits.
    The KITs could be included one to multiple components.
    I would like to use macro for the following process:
    - search the item code from the beginning of the forecast sheet on the BOM sheet if finds a match (means this item is a KIT) insert a row or insert row below the item code on sheet1 and insert the component code(s) from the sheet2 column C to this(these) rows and copy the quantity of the KIT (the KIT row is above these new rows) to this(these) rows.
    This should run row by row until find an empty cell.

    I tried several sample codes from Excel Forum for example this:
    Option Explicit
    Public Sub PHI()
        Dim myRange
        Sheets("Sheet1").Activate
        Range("A1").Activate
        Sheets("Sheet2").Activate
        Range("A1").Activate
        While Not IsEmpty(ActiveCell.Value)
            With Sheets("Sheet1").Range("A1", _
                                        "A" & ActiveCell.SpecialCells(xlLastCell).Row)
                Set myRange = .Find(ActiveCell.Value, LookIn:=xlValues)
                If Not myRange Is Nothing Then
                    myRange.Offset(0, 7).Value = ActiveCell.Offset(0, 7).Value
                End If
            End With
            ActiveCell.Offset(1, 0).Activate
        Wend
    End Sub
    I 've modified the above code but it is find and write on the active sheet only not write on the other.
    And I can insert row only above of the cell but I need it(them) below of the cell.

    I'm using Excel 2007.
    I have attached the sample.
    Forecast_BOM.xlsx

    Do you have any ideas?

    Thanks in advance.

    Peter
    Last edited by SPet; 10-12-2012 at 04:11 AM.

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