+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Post production report update from packing report.

    dear friends i want to update my first sheet from second sheet.second sheet our packing report & it's daily I'm getting from packing department.according to packing report i want to update production sheet.second sheet Column "F" first 6 characters i need to mach with first sheet column "K" first 6 characters.if it is match then first sheet column "J" values need to reduce form second sheet column "G".
    ex- first sheet value = 60
    packing report value = 50 then answer in first sheet column "J" =60-50 = 10
    after updating first sheet column "J" any value coming mines then that row need to delete.
    pls make macro for this.thanks..
    Attached Files Attached Files
    Last edited by johncena; 03-22-2010 at 05:34 AM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    This should do it:

    Code:
    Option Explicit
    
    Sub PackingToProductionUpdate()
    Dim LotFind As Range, Lots As Range, LotNum As Range
    Application.ScreenUpdating = False
    
    Set Lots = Sheets("Packing").Range("F5", Range("F" & Rows.Count).End(xlUp))
    On Error Resume Next
    
    For Each LotNum In Lots
        With Sheets("Production")
            Set LotFind = .Columns("K:K").Find(Left(LotNum, 6), After:=.Range("K" & Rows.Count), LookIn:=xlValues, _
                LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            
            If Not LotFind Is Nothing Then
                LotFind.Offset(0, -1).Value = LotFind.Offset(0, -1).Value - LotNum.Offset(0, 1).Value
                LotNum.EntireRow.ClearContents
                Set LotFind = Nothing
            End If
        
        End With
    Next LotNum
    
    Application.ScreenUpdating = True
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    2,815

    Re: production report update from packing report.

    This might be what you need.

    Code:
    Sub Process()
    For N = 5 To Sheets("PACKING").Cells(Rows.Count, 1).End(xlUp).Row
        If Application.CountIf(Sheets("PRODUCTION").Columns(11), Left(Sheets("PACKING").Cells(N, 6), 6)) = 1 Then
            Set TargetCell = Sheets("PRODUCTION").Columns(11).Find(Left(Sheets("PACKING").Cells(N, 6), 6), , xlValues, xlPart)
            TargetCell.Offset(0, -1) = TargetCell.Offset(0, -1) - Sheets("PACKING").Cells(N, 7)
            If TargetCell.Offset(0, -1) < 0 Then TargetCell.EntireRow.Delete
        End If
    Next N
    End Sub
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  4. #4
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Post Re: production report update from packing report.

    dear JB thanks u very much for your helps.i have two problems.one is below code giving some error.other one is both sheet values are equals then first sheet that row also need to delete.i mean after minus first reports values from second sheet values answers are zero or minus then that all rows should delete,
    Code:
    Set Lots = Sheets("Packing").Range("F5", Range("F" & Rows.Count).End(xlUp))
    Last edited by johncena; 03-21-2010 at 01:33 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Re: production report update from packing report.

    dear mrice.your macro matching all cell values.not first 6 characters.if second sheet column "F" value = 126546D & first sheet Column "K" value = 126546A-D then your macro not working.& other thing is some values u reducing form first sheet column "K" that values can i see,i mean not final answer.if i click that cell it should below example.
    ex- =150-50

  6. #6
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    Here's the update to delete the PRODUCTION row if the value drops to zero or below:
    Code:
    Option Explicit
    
    Sub PackingToProductionUpdate()
    Dim LotFind As Range, Lots As Range, LotNum As Range
    Dim LotVal As Double
    Application.ScreenUpdating = False
    
    Set Lots = Sheets("Packing").Range("F5", Range("F" & Rows.Count).End(xlUp))
    On Error Resume Next
    
    For Each LotNum In Lots
        With Sheets("Production")
            Set LotFind = .Columns("K:K").Find(Left(LotNum, 6), After:=.Range("K" & Rows.Count), LookIn:=xlValues, _
                LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
    
            If Not LotFind Is Nothing Then
                LotVal = LotFind.Offset(0, -1).Value - LotNum.Offset(0, 1).Value
                    If LotVal <= 0 Then
                        LotFind.EntireRow.Delete xlShiftUp
                    Else
                        LotFind.Offset(0, -1).Value = LotVal
                    End If
                LotNum.EntireRow.ClearContents
                Set LotFind = Nothing
            End If
        End With
    Next LotNum
    
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  7. #7
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Re: production report update from packing report.

    dear JB everything work very well.just one adjustment i need.some values u reducing form first sheet column "K" that values can i see,i mean not final answer.if i click that cell it should below example.then i can understand how much packed & how much balance to pack.
    ex- =4500-500
    Last edited by johncena; 03-21-2010 at 04:45 AM.

  8. #8
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    Um.........huh?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  9. #9
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Re: production report update from packing report.

    sorry JB if it is not possible then leave it.no problem.u help me a lot.if u can do it.it's very help full for me..

  10. #10
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    If I can do what?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  11. #11
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Post Re: production report update from packing report.

    JB.I'm talking about # 7 post request.

  12. #12
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    My reply to your post #7 is summed up in post #8.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  13. #13
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Post Re: production report update from packing report.

    thanks for your all helps JB.now everything work very well,i have replace this macro code with..
    Code:
    LotFind.Offset(0, -1).Value = LotVal
    this..
    Code:
    LotFind.Offset(0, -1).Value = "=" & LotFind.Offset(0, -1).Value & "-" & LotNum.Offset(0, 1).Value
    thanks a lot again.REP+ add.

  14. #14
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    18,228

    Re: production report update from packing report.

    Ah...the lights have got on. Now I see what you mean. Nice work, John!
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  15. #15
    Valued Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    286

    Re: production report update from packing report.

    JB again i need your help.my code doing some mistakes.if one time I'm reduced some values my code work very well.if i reduced more than one time my requirement not success.
    ex-sheet one cell value =200
    one time reduce =50
    my code answer giving correct =200-50
    if i reduce again =50
    macro answer =150-50
    it should =200-50-50
    pls help me sir...

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