+ Reply to Thread
Results 1 to 4 of 4

Object Error, Merge cells and Sheet rename.

  1. #1
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Object Error, Merge cells and Sheet rename.

    I am getting 2 object errors within the below code,
    Please Login or Register  to view this content.
    The first one is with the merge cell command on the 22 row,
    Please Login or Register  to view this content.
    The second one is on the 35 row in this part of the code, the error is the last line of the below code.
    Please Login or Register  to view this content.
    I have uploaded a demo file with any sensitive info removed. Also forgive everything being in Japanese. Any help would be very much appreciated.

    Cheers
    Attached Files Attached Files
    Last edited by JapanDave; 08-26-2011 at 04:39 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Object Error, Merge cells and Sheet rename.

    Hi Japan Dave,

    First - always have Option Explicit as the first line of your code. Then you will need to Dim all variables. When I did that it said that WSCount was not defined.

    WSCont <> WSCount (Is this your second error?)

    Look at the Copy... Destination:= Syntax. You may need Workbook.Worksheet.Range to do it correctly.

    I remember needing ActiveWorkbook or ActiveSheet in destination part.
    Last edited by MarvinP; 08-25-2011 at 11:39 PM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Object Error, Merge cells and Sheet rename.

    Hey Marvin,

    I will look into "Option Explicit " as I don't know how to use it yet.

    And my second mistake was the last line, sorry that was a typo. Even when I fixed the typo I get stuck on that last line of code when renaming the sheet.

    The funny thing is that I have been using similar code on a different worbook and now it has stopped working to. I am a little confused about that.

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Object Error, Merge cells and Sheet rename.

    I figured it out myself. Thanks Marvin.

+ 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