+ Reply to Thread
Results 1 to 7 of 7

Type Mismatch Error

Hybrid View

  1. #1
    Registered User
    Join Date
    04-12-2006
    Posts
    39

    Type Mismatch Error

    I get a type mismatch error on Set rng1 = rng(res, 5)
    How do I fix this? Thanks Jody

    Private Sub CommandButtonPriceNext_Click()
    Dim rng As Range, rng1 As Range, res As Variant
    Set rng = Range("PriceBookDatabase")
    res = Application.VLookup(Label1stICLabel.Caption, rng, 1, False)
    If Not IsError(res) Then
    Set rng1 = rng(res, 5)
    rng1.Value = Me.TextBoxGradeA_RetailValue.Text
    End If
    MultiPage2.Value = 15
    End Sub

  2. #2
    Bob Phillips
    Guest

    Re: Type Mismatch Error

    Try

    Set rng1 = Cells(res, 5)


    assuming res is a valid number

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "ssjody" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I get a type mismatch error on Set rng1 = rng(res, 5)
    > How do I fix this? Thanks Jody
    >
    > Private Sub CommandButtonPriceNext_Click()
    > Dim rng As Range, rng1 As Range, res As Variant
    > Set rng = Range("PriceBookDatabase")
    > res = Application.VLookup(Label1stICLabel.Caption, rng, 1, False)
    > If Not IsError(res) Then
    > Set rng1 = rng(res, 5)
    > rng1.Value = Me.TextBoxGradeA_RetailValue.Text
    > End If
    > MultiPage2.Value = 15
    > End Sub
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile:

    http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=567801
    >




  3. #3
    Registered User
    Join Date
    04-12-2006
    Posts
    39
    Hi Bob,

    I changed Set rng1 = rng(res, 5) to the below and I still get the Type Mismatch Error. res is a valid number. Any other Ideas? Thanks Jody

    Private Sub CommandButtonPriceNext_Click()
    Dim rng As Range, rng1 As Range, res As Variant
    Set rng = Range("PriceBookDatabase")
    res = Application.VLookup(Label1stICLabel.Caption, rng, 1, False)
    If Not IsError(res) Then
    Set rng1 = Cells(res, 5)
    rng1.Value = Me.TextBoxGradeA_RetailValue.Text
    End If
    MultiPage2.Value = 15
    End Sub

  4. #4
    Bob Phillips
    Guest

    Re: Type Mismatch Error

    What's is res at this point? Add Msgbox res to see it.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "ssjody" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Bob,
    >
    > I changed Set rng1 = rng(res, 5) to the below and I still get the Type
    > Mismatch Error. res is a valid number. Any other Ideas? Thanks Jody
    >
    > Private Sub CommandButtonPriceNext_Click()
    > Dim rng As Range, rng1 As Range, res As Variant
    > Set rng = Range("PriceBookDatabase")
    > res = Application.VLookup(Label1stICLabel.Caption, rng, 1, False)
    > If Not IsError(res) Then
    > Set rng1 = Cells(res, 5)
    > rng1.Value = Me.TextBoxGradeA_RetailValue.Text
    > End If
    > MultiPage2.Value = 15
    > End Sub
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile:

    http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=567801
    >




  5. #5
    Registered User
    Join Date
    04-12-2006
    Posts
    39
    Hi Bob, Thanks for the help.

    res at this point is "IC# 65033A"

    Jody

  6. #6
    Bob Phillips
    Guest

    Re: Type Mismatch Error

    Well, there is your problem. You are trying to pass that as a row number,
    which it isn't, so it fails.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "ssjody" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Bob, Thanks for the help.
    >
    > res at this point is "IC# 65033A"
    >
    > Jody
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile:

    http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=567801
    >




  7. #7
    Bob Phillips
    Guest

    Re: Type Mismatch Error

    Well, there is your problem. You are trying to pass that as a row number,
    which it isn't, so it fails.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "ssjody" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi Bob, Thanks for the help.
    >
    > res at this point is "IC# 65033A"
    >
    > Jody
    >
    >
    > --
    > ssjody
    > ------------------------------------------------------------------------
    > ssjody's Profile:

    http://www.excelforum.com/member.php...o&userid=33398
    > View this thread: http://www.excelforum.com/showthread...hreadid=567801
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1