R
Ryan H
I have a UDF below that is located in a Standard Module.
Type Totals
COGS As Double
Material As Double
Labor As Double
UnitPrice As Currency
QuotePrice As Currency
End Type
I declared a Public Variable in another Standard Module like this.
Public Total As Totals
For some reason when I use Total with the With...End With Statement in the
code below VBA is throwing an exception stating "With object must be
user-defined type, variant or object". Anybody know why?
Sub Test()
With Total
' determines labor effiency % and COGS %
Select Case Val(tbxQuantity)
Case Is = 1
.COGS = 1.1
Case Is = 2
.COGS = 1.08
Case Is >= 3
.COGS = 1.05
End Select
.Material = 300
.Labor = 1000
End With
End Sub
Type Totals
COGS As Double
Material As Double
Labor As Double
UnitPrice As Currency
QuotePrice As Currency
End Type
I declared a Public Variable in another Standard Module like this.
Public Total As Totals
For some reason when I use Total with the With...End With Statement in the
code below VBA is throwing an exception stating "With object must be
user-defined type, variant or object". Anybody know why?
Sub Test()
With Total
' determines labor effiency % and COGS %
Select Case Val(tbxQuantity)
Case Is = 1
.COGS = 1.1
Case Is = 2
.COGS = 1.08
Case Is >= 3
.COGS = 1.05
End Select
.Material = 300
.Labor = 1000
End With
End Sub