+ Reply to Thread
Results 1 to 10 of 10

Type mismatch using worksheet object arguments in procedure

  1. #1
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Type mismatch using worksheet object arguments in procedure

    I get a type mismatch when trying to use the following in a module:

    Please Login or Register  to view this content.
    The error comes from the "Worksheets(fromsheet).Activate" line, and I suspect it will occur again when I use the tosheet argument. I call this procedure using the line of code:

    Please Login or Register  to view this content.
    Where wobid and res are the names of sheets in my workbook. Any ideas why i get the error?

    Thank you very much

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Type mismatch using worksheet object arguments in procedure

    I understand that you want to copy data from one sheet to the other. What is the condition for the copy?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Type mismatch using worksheet object arguments in procedure

    The condition is that column "S" has a value of "Completed"

  4. #4
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Type mismatch using worksheet object arguments in procedure

    Please Login or Register  to view this content.
    I just noticed the middle part of the code should look like this.

    In context, col1 is column S of my sheet wobid.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Type mismatch using worksheet object arguments in procedure

    Please Login or Register  to view this content.
    because fromsheet is a worksheet object
    Last edited by arlu1201; 09-21-2012 at 12:45 PM.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Type mismatch using worksheet object arguments in procedure

    JosephP you're an absolute genius.

    Thank you

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Type mismatch using worksheet object arguments in procedure

    you're welcome :-)

  8. #8
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Type mismatch using worksheet object arguments in procedure

    Wait! one last question. I now try to add other criteria and it gives me the error again!!

    Please Login or Register  to view this content.
    I don't see the problem here! Please help

  9. #9
    Registered User
    Join Date
    10-06-2011
    Location
    Salt Lake City, UT
    MS-Off Ver
    Excel 2010
    Posts
    78

    Re: Type mismatch using worksheet object arguments in procedure

    It highlights this portion with the type mismatch

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    08-17-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Type mismatch using worksheet object arguments in procedure

    Post you excel file, I think I might have a solution to what you are trying to so. To be clear, you want your macro to check in column S to see if the value is "Completed", if so you want to copy that entire row to a new sheet?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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