+ Reply to Thread
Results 1 to 3 of 3

Type Mismatch

  1. #1
    Brad
    Guest

    Type Mismatch

    Hello, I am getting a type mismatch on the following line of my code. I have
    included the entire code at the bottom. I would appreciate any help. Thanks.

    ***TYPE MISMATCH LINE***
    Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    Rows.Count).End(xlUp)(2)
    *****

    Entire code:

    Sub addtoqueue()
    Dim usrid As String
    Dim AWB As Workbook
    Dim uswb As Workbook
    Dim Destination As Range
    Set AWB = ActiveWorkbook
    usrid = Environ("Username")
    Application.ScreenUpdating = False
    Set uswb = Workbooks.Open(Filename:= _
    "G:\Contract QuoteTemplates\2005 quote " & _
    "template\print queue\" & usrid & ".xls")
    Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    Rows.Count).End(xlUp)(2)
    Destination = AWB.FullName ' or AWB.Name
    uswb.Close SaveChanges:=True
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Bob Phillips
    Guest

    Re: Type Mismatch

    Hi Brad,

    Try

    Set Destination = uswb.Worksheets("Sheet1").Range("A" & _
    Rows.Count).End(xlUp)(2)


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Brad" <[email protected]> wrote in message
    news:[email protected]...
    > Hello, I am getting a type mismatch on the following line of my code. I

    have
    > included the entire code at the bottom. I would appreciate any help.

    Thanks.
    >
    > ***TYPE MISMATCH LINE***
    > Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    > Rows.Count).End(xlUp)(2)
    > *****
    >
    > Entire code:
    >
    > Sub addtoqueue()
    > Dim usrid As String
    > Dim AWB As Workbook
    > Dim uswb As Workbook
    > Dim Destination As Range
    > Set AWB = ActiveWorkbook
    > usrid = Environ("Username")
    > Application.ScreenUpdating = False
    > Set uswb = Workbooks.Open(Filename:= _
    > "G:\Contract QuoteTemplates\2005 quote " & _
    > "template\print queue\" & usrid & ".xls")
    > Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    > Rows.Count).End(xlUp)(2)
    > Destination = AWB.FullName ' or AWB.Name
    > uswb.Close SaveChanges:=True
    > Application.ScreenUpdating = True
    > End Sub




  3. #3
    Brad
    Guest

    Re: Type Mismatch

    That did the trick. Thanks Bob!

    "Bob Phillips" wrote:

    > Hi Brad,
    >
    > Try
    >
    > Set Destination = uswb.Worksheets("Sheet1").Range("A" & _
    > Rows.Count).End(xlUp)(2)
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Brad" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello, I am getting a type mismatch on the following line of my code. I

    > have
    > > included the entire code at the bottom. I would appreciate any help.

    > Thanks.
    > >
    > > ***TYPE MISMATCH LINE***
    > > Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    > > Rows.Count).End(xlUp)(2)
    > > *****
    > >
    > > Entire code:
    > >
    > > Sub addtoqueue()
    > > Dim usrid As String
    > > Dim AWB As Workbook
    > > Dim uswb As Workbook
    > > Dim Destination As Range
    > > Set AWB = ActiveWorkbook
    > > usrid = Environ("Username")
    > > Application.ScreenUpdating = False
    > > Set uswb = Workbooks.Open(Filename:= _
    > > "G:\Contract QuoteTemplates\2005 quote " & _
    > > "template\print queue\" & usrid & ".xls")
    > > Set Destination = uswb.Worksheets(Sheet1).Range("A" & _
    > > Rows.Count).End(xlUp)(2)
    > > Destination = AWB.FullName ' or AWB.Name
    > > uswb.Close SaveChanges:=True
    > > Application.ScreenUpdating = True
    > > End Sub

    >
    >
    >


+ 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