+ Reply to Thread
Results 1 to 7 of 7

VBA error in excel 2013

  1. #1
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    VBA error in excel 2013

    I've recently upgraded to excel 2013, and some VBA code (below) which worked fine in Excel 2007 now seems to return errors:

    Please Login or Register  to view this content.
    The specific error it returns is "run-time error '1004'", and I've been able to debug the error to the line of code ".Name = Sheets(1).Range("C" & i).Value"

    Background:

    I currently have a master sheet (Sheet 1) containing about 200 codes (C2:C201), with 200 individual sheets (sheet 2, sheet 3,..., sheet 201) in the workbook I want to be renamed, edited individually, and have their separate web queries updated in each sheet.

    The purpose of the code is to have VBA rename sheet2 from the list (it would be from c2, "AAA"), then within sheet2 (now renamed AAA) I would like the new name of the sheet to be entered in cell H1. I have web queries in each of the sheets synced up so that when H1 is changed, they automatically update from the web, so the vba pauses until all the query updates within a given sheet are finished, and once the sheet has updated, move on and do the same thing for sheet3, sheet4, sheet5, etc. pausing each time to let each sheet update from their individual web queries after their names have been changed.

    Any help is very much appreciated, even if it is just some advice on perhaps why the error is now occurring, or why it occurs on that specific line.

    Thanks

  2. #2
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: VBA error in excel 2013

    .Name = Sheets("1").Range("C" & i).Value
    .Range("H1").Value = Sheets("1").Range("C" & i).Value

    Your sheet is call 1 ,right?
    "1"
    -If the problem is solved, please mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved".

    -Always upload a workbook before start your question
    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

    +++ If my answer(s) helped you, please add me reputation by click on * +++

  3. #3
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: VBA error in excel 2013

    The first sheet is called Sheet1, and I want to rename sheet2 - sheet 201 using the three letter codes in the C column in sheet1.

    I was kindly given this code on a forum (possibly this one) a while ago, and it worked well in excel 2007, but upgrading a complex system is never as smart as it seems.

  4. #4
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: VBA error in excel 2013

    .Name = Sheets("Sheet1").Range("C" & i).Value
    .Range("H1").Value = Sheets("Sheet1").Range("C" & i).Value

  5. #5
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: VBA error in excel 2013

    That seemed to have helped, thanks.

    Just for my own future reference, any idea what the error refers to?

  6. #6
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: VBA error in excel 2013

    I no expert, i dont know the error refer to.But i always using F8 to debug which line occur error.

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

    Re: VBA error in excel 2013

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    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]

+ 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