Type Mismatch

G

Guest

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
 
B

Bob Phillips

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)
 
G

Guest

That did the trick. Thanks Bob!

Bob Phillips said:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top