dear friend below macro work fine for me.only the thing is this macro final answer giving as a value.
ex- =250-50=200
this macro giving that final answer i mean 200.but i need answer like this =250-50
when i click that cell it should =250-50 like this.not only =200
pls any body can modify this macro.other whole thing in macro work very well.
Code: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




Reply With Quote