Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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" wrote in message
...
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
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
type mismatch--how to fix rroach Excel Discussion (Misc queries) 2 July 14th 05 06:23 PM
type mismatch? Gixxer_J_97[_2_] Excel Programming 4 April 1st 05 03:20 AM
type mismatch here! J_J[_2_] Excel Programming 2 March 14th 05 03:14 PM
Type mismatch Patti[_5_] Excel Programming 3 May 30th 04 02:44 PM
Type Mismatch Phil Hageman[_3_] Excel Programming 2 January 9th 04 06:11 PM


All times are GMT +1. The time now is 06:31 PM.

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

About Us

"It's about Microsoft Excel"