please help me again

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    please help me again

    help a dumb newbie
    iam using vba with excel 2000. iam trying to create a class

    Option Explicit
    Public swap As swapdb
    Private m_number As Byte
    Private m_units, m_notional, m_libor, cvalue As Double
    Private m_name, m_ticker As String
    Private m_td, m_exdate, m_r1, m_r2, m_r3, m_r4 As Date

    Public Property Get addnumber() As Double
    addnumber = m_number 'new swap #
    End Property

    Public Property Let addnumber(ByVal newnumber As Double)
    m_number = newnumber
    End Property
    Public Property Get addunits() As Double
    addunits = m_units 'new swap units
    End Property

    Public Property Let addunits(ByVal newunits As Double)
    m_units = newunits
    End Property
    Public Property Get addname() As String
    addname = m_name 'new swap name
    End Property

    Public Property Let addname(ByVal newname As String)
    m_name = newname
    End Property
    Public Property Get addticker() As String
    addticker = m_ticker 'new swap ticker
    End Property

    Public Property Let addticker(ByVal newticker As String)
    m_ticker = newticker
    End Property
    Public Property Get addnotional() As Double
    addnotional = m_notional 'new notional amount
    End Property

    Public Property Let addnotional(ByV al newnotional As Double)
    m_ticker = newnotional
    End Property
    Public Property Get addlibor() As Double
    addlibor = m_libor 'new libor rate
    End Property

    Public Property Let addlibor(ByVal newlibor As Double)
    m_libor = newlibor
    End Property
    Public Property Get addtd() As Date
    addtd = m_td 'trade date
    End Property

    Public Property Let addtd(ByVal newtd As Date)
    m_td = newtd
    End Property
    Public Property Get addexdate() As Date
    addexdate = m_exdate 'expiration date
    End Property

    Public Property Let addexdate(ByVal newexdate As Date)
    m_exdate = newexdate
    End Property
    Public Property Get addr1() As Date
    addr1 = m_r1 'reset date1
    End Property

    Public Property Let addr1(ByVal newr1 As Date)
    m_r1 = newr1
    End Property
    Public Property Get addr2() As Date
    addr2 = m_r2 'reset date2
    End Property

    Public Property Let addr2(ByVal newr2 As Date)
    m_r2 = newr2
    End Property
    Public Property Get addr3() As Date
    addr3 = m_r3 'reset date3
    End Property

    Public Property Let addr3(ByVal newr3 As Date)
    m_r3 = newr3
    End Property
    Public Property Get addr4() As Date
    addr4 = m_r4 'reset date4
    End Property

    Public Property Let addr4(ByVal newr4 As Date)
    m_r4 = newr4
    End Property
    Public Sub addswap()
    swap.addnumber = Range("b2")
    swap.addname = Range("b4")
    swap.addtd = Range("b6")
    swap.addexdate = Range("b8")
    swap.addunits = Range("b10")
    swap.addnotiona l = Range("b12")
    swap.addlibor = Range("b14")
    swap.addticker = Range("b16")
    swap.addr1 = Range("b18")
    swap.addr2 = Range("b20")
    swap.addr3 = Range("b22")
    swap.addr4 = Range("b24")
    End Sub

    Public Function getswap()
    swap.addnumber = Range("b2")
    swap.addname = Range("b4")
    swap.addtd = Range("b6")
    swap.addexdate = Range("b8")
    swap.addunits = Range("b10")
    swap.addnotiona l = Range("b12")
    swap.addlibor = Range("b14")
    swap.addticker = Range("b16")
    swap.addr1 = Range("b18")
    swap.addr2 = Range("b20")
    swap.addr3 = Range("b22")
    swap.addr4 = Range("b24")
    End Function

    i cant get this to work, it says user type not defined etc.
    iam trying to create a class called swap
    with notional, number. etc as variables. i would like to create
    another 10 instances of this class
    where am i messing up?

    thanks
Working...