Hi again.
I am trying to create a Workbook Event.
I am having issues when I try to multiply cell E2 by a value in the Name "Duty".
The line in the code that is hanging me up is
The only thing I can envision is that I have not defined the cell E2 as anything. Could that be the problem, or an I missing some very basic syntax?
The entire code so far (will be cleaned up, and variables made worksheet specific, eventually)
I am trying to create a Workbook Event.
I am having issues when I try to multiply cell E2 by a value in the Name "Duty".
The line in the code that is hanging me up is
Code:
Cells(2, 6).Value = Cells(2, 5).Value * Names("Duty").Value
The entire code so far (will be cleaned up, and variables made worksheet specific, eventually)
Code:
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Names.Add Name:="Duty", RefersTo:=0.06
Names.Add Name:="HST", RefersTo:=0.13
Names.Add Name:="Profit", RefersTo:=0.12
Names.Add Name:="Freight", RefersTo:=0.36
Sh.Name = "Test1"
Cells(1, 1).Value = "Description"
Cells(1, 2).Value = "Plank Type"
Cells(1, 3).Value = "Sq.Ft/Pack"
Cells(1, 4).Value = "In Stock"
Cells(1, 5).Value = "$/Sq.Ft."
Cells(1, 6).Value = "Duty"
Cells(1, 7).Value = "HST"
Cells(1, 8).Value = "Markup"
Cells(1, 9).Value = "Freight"
Cells(1, 10).Value = "Subtotal"
Cells(2, 6).Value = Cells(2, 5).Value * Names("Duty").Value
Rows("1:1").Font.Bold = True
Columns("I:I").NumberFormat = "$#,##0.00"
Cells.Columns.AutoFit
End Sub