Results 1 to 8 of 8

Help with Run-time error '32809'

This is a discussion on Help with Run-time error '32809' within the Excel Questions forums, part of the Question Forums category; I'm having an issue moving 1 tab from workbook to another. I even used the built in "record macro" and ...

  1. #1
    New Member
    Join Date
    Jul 2011
    Posts
    4

    Default Help with Run-time error '32809'

    I'm having an issue moving 1 tab from workbook to another. I even used the built in "record macro" and when I run the macro I always get an the:

    Run-time error '32809'
    Applications-defined or object-defined error
    This is where the issue starts:

    Sheets("English Summary").Select
    Sheets("English Summary").Copy After:=Workbooks("Test1.xls").Sheets(2)
    Any ideas how to resolve this without renaming the "English Summary" tab?

    Thanks

  2. #2
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    11,704

    Default Re: Help with Run-time error '32809'

    You may have to reference the workbook in the code if the workbook that contains the sheet "English Summary" isn't the active workbook.

    This assumes the workbook with English Summary is the same workbook with the macro.

    Code:
    ThisWorkbook.Sheets("English Summary").Copy After:=Workbooks("Test1.xls").Sheets(2)
    Note: you don't have to .Select the worksheet to copy it.
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    Please surround your pasted VBA code with CODE tags e.g.;
    [CODE] your VBA code here [/CODE]
    The pound # icon in the forum editor will apply the CODE tags around your selected text.

  3. #3
    New Member
    Join Date
    Jul 2011
    Posts
    4

    Default Re: Help with Run-time error '32809'

    I have the correct workbook selected (see code below). I've noticed that if a tab within a workbook starts with the word "English", copying the tab another workbook causes an issue with the macro.

    Windows("Test2.xls").Activate
    Sheets("English Summary").Select
    Sheets("English Summary").Copy After:=Workbooks("Test1.xls").Sheets(2)

  4. #4
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    11,704

    Default Re: Help with Run-time error '32809'

    Does it error on your .Select line or your .Copy line?
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    Please surround your pasted VBA code with CODE tags e.g.;
    [CODE] your VBA code here [/CODE]
    The pound # icon in the forum editor will apply the CODE tags around your selected text.

  5. #5
    New Member
    Join Date
    Jul 2011
    Posts
    4

    Default Re: Help with Run-time error '32809'

    It stops on "Sheets("English Summary").Select" for some reason.

  6. #6
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    11,704

    Default Re: Help with Run-time error '32809'

    Check the spelling of the sheet name including spaces in between, leading, and trailing. The name in the code has to be exactly the same as the name on the worksheet tab. My guess is a trailing space e.g. "English Summary "
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    Please surround your pasted VBA code with CODE tags e.g.;
    [CODE] your VBA code here [/CODE]
    The pound # icon in the forum editor will apply the CODE tags around your selected text.

  7. #7
    New Member
    Join Date
    Jul 2011
    Posts
    4

    Default Re: Help with Run-time error '32809'

    I have checked that. There are no spaces, beginning or end in the tab name.

    I used the built in "Record New Macro" to create the macro I posted, so you would think it would take the correct tab name.

    Is there a function in Excel VBA called "English" that it might be confusing the sheet selection?

  8. #8
    MrExcel MVP AlphaFrog's Avatar
    Join Date
    Sep 2009
    Posts
    11,704

    Default Re: Help with Run-time error '32809'

    Quote Originally Posted by yirrlaar View Post
    Is there a function in Excel VBA called "English" that it might be confusing the sheet selection?
    No VBA function called English.

    I don't know what else to tell you. I still think it has something to do with the sheet name in the code not exact matching the name on the tab.

    If the worksheet English Summary is always in the same location (e.g. the 1st sheet in Test1.xls), then you can select it based on its position

    Code:
    Sheets(1).Select
    Or the last sheet
    Code:
    Sheets(Sheets.Count).Select
    Paste your Excel data to the forum...
    MrExcel HTML Maker or Excel Jeanie

    Please surround your pasted VBA code with CODE tags e.g.;
    [CODE] your VBA code here [/CODE]
    The pound # icon in the forum editor will apply the CODE tags around your selected text.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com