LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default User-defined Type Issue

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

--
Cheers,
Ryan
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile error: User-defined type not defined Ayo Excel Programming 3 April 23rd 09 07:42 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 08:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"