gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I need to adjust this so that the user can enter "0" as the value in H
( If Sheets("3 Enter Quote Data").Range("H" & Z).Value > 0 Then)
If I change it to " > -1" instead of "> 0" then its looking at blanks as if they are "0".
How do I adjust this code so the user can enter 0 in column H? column H is the Unit cost so they are entering a dollar amount. Sometime it will be zero.
Thanks!
( If Sheets("3 Enter Quote Data").Range("H" & Z).Value > 0 Then)
If I change it to " > -1" instead of "> 0" then its looking at blanks as if they are "0".
How do I adjust this code so the user can enter 0 in column H? column H is the Unit cost so they are entering a dollar amount. Sometime it will be zero.
Thanks!
Code:
Sub AddToCostSourceDetailsTemplate()
Dim SumExcess As Double
Dim SumNRE As Double
Dim SumTariff As Double
Dim SourceType As Variant
Dim SourceTable As ListObject
Dim PATH As Variant
Dim VendorTable As ListObject
SumExcess = Application.WorksheetFunction.Sum(Sheet4.Range("I24:I56"))
SumNRE = Application.WorksheetFunction.Sum(Sheet4.Range("J24:J56"))
SumTariff = Application.WorksheetFunction.Sum(Sheet4.Range("K24:K56"))
Set SourceTable = Sheet6.ListObjects("Source_Type")
Set VendorTable = Sheet3.ListObjects("Selected_Vendors")
'Identify Current User
CurrentUser = Environ("UserName")
Dim CSDLR As Long
For Z = 24 To 56
If Sheets("3 Enter Quote Data").Range("H" & Z).Value > 0 Then
CSDLR = Sheets("Cost Source Details").Cells(Rows.Count, "A").End(xlUp).Row + 1
'Material
Sheets("Cost Source Details").Range("A" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("F18").Value
'Material Type
Sheets("Cost Source Details").Range("B" & CSDLR).Value = "Part"
'Type
SourceType = Application.VLookup(Sheets("3 Enter Quote Data").Range("I12").Value, SourceTable.Range, 2, False)
Sheets("Cost Source Details").Range("C" & CSDLR).Value = SourceType
'PP ID
Sheets("Cost Source Details").Range("D" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L5").Value
'PP Revision
Sheets("Cost Source Details").Range("E" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("P5").Value
'*********************************************************************************
'From Qty
Sheets("Cost Source Details").Range("F" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("F" & Z).Value
Sheets("Cost Source Details").Range("G" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("G" & Z).Value
Sheets("Cost Source Details").Range("H" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("H" & Z).Value
If Sheets("3 Enter Quote Data").Range("I" & Z).Value > 0 And Sheets("3 Enter Quote Data").Range("J" & Z).Value > 0 And Sheets("3 Enter Quote Data").Range("K" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{EXCESS: $" & Sheets("3 Enter Quote Data").Range("I" & Z).Value & "} " & "{TARIFF: $" & Sheets("3 Enter Quote Data").Range("K" & Z).Value & "}" & " {NRE: $" & Sheets("3 Enter Quote Data").Range("J" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("J" & Z).Value > 0 And Sheets("3 Enter Quote Data").Range("I" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{EXCESS: $" & Sheets("3 Enter Quote Data").Range("I" & Z).Value & "} " & "{NRE: $" & Sheets("3 Enter Quote Data").Range("J" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("J" & Z).Value > 0 And Sheets("3 Enter Quote Data").Range("K" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{EXCESS: $" & Sheets("3 Enter Quote Data").Range("I" & Z).Value & "} " & "{NRE: $" & Sheets("3 Enter Quote Data").Range("J" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("I" & Z).Value > 0 And Sheets("3 Enter Quote Data").Range("K" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{EXCESS: $" & Sheets("3 Enter Quote Data").Range("I" & Z).Value & "} " & "{TARIFF: $" & Sheets("3 Enter Quote Data").Range("K" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("I" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{EXCESS: $" & Sheets("3 Enter Quote Data").Range("I" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("K" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{NRE: $" & Sheets("3 Enter Quote Data").Range("K" & Z).Value & "}"
Else
If Sheets("3 Enter Quote Data").Range("J" & Z).Value > 0 Then
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value & " " & "{TARIFF: $" & Sheets("3 Enter Quote Data").Range("K" & Z).Value & "}"
Else
Sheets("Cost Source Details").Range("I" & CSDLR).Value = Sheets("3 Enter Quote Data").Range("L" & Z).Value
End If
End If
End If
End If
End If
End If
End If
End If
Next Z
End Sub