+ Reply to Thread
Results 1 to 8 of 8

Update a cell value from a previous sheet after copying the sheet and renaming it

  1. #1
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Update a cell value from a previous sheet after copying the sheet and renaming it

    This is the code that I have so far.

    I have copied a sheet, moved it to the end and renamed it with a date that is in cell "A1"

    Now after that process is finished I need it to update the date in cell "A1" of the newly created sheet with the next day's date.

    I am stuck however referring to the previous sheet to update the date value in "A1"

    Please Login or Register  to view this content.
    Last edited by Mistweaver; 11-21-2009 at 10:01 AM. Reason: Problem is solved

  2. #2
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    Solved it!

    It was quite easy really just had to look at it froma different angle

    Please Login or Register  to view this content.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    Perhaps

    Please Login or Register  to view this content.
    When a sheet is copied by default it becomes the ActiveSheet ... also given the code will by default execute on the ActiveWorkbook there's no need (as I see things) to specify the WB in this instance.

    As a habit it's no bad thing to release your objects at the end of your routine (ie Set object = Nothing)
    Last edited by DonkeyOte; 11-21-2009 at 09:21 AM.

  4. #4
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    Thanks for your help and the advice I am extremely grateful. Thanks mate.

    The new code that you posted works fine once, however when it comes to creating the next sheet in the sequence it fails at this line

    Please Login or Register  to view this content.
    EDIT: I just realised that you replied to my first post and not the second with the new solution that I had figured out.


    So using your code as the solution I updated it change the value in Cell "A1" of the newly created sheet.

    Please Login or Register  to view this content.
    Last edited by Mistweaver; 11-21-2009 at 09:28 AM.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    You should, as a matter of course validate existence of "new sheet name" before trying to name it - ie if 22 Nov 2009 exists already you can't have a further sheet of the same name in the same file.

  6. #6
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    Don't want to make assumptions here and I apologize in advance if I am in error, but this appears to be a cross-post at Ozgrid, albeit the OP is using a different user name.

    Name Worksheet With Date Residing In A Cell
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    Thanks for the heads up Palmetto, I hate wasting my free time.

    Mistweaver, note:

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

  8. #8
    Registered User
    Join Date
    11-20-2009
    Location
    Cardiff
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: Update a cell value from a previous sheet after copying the sheet and renaming it

    It appears I have offended several people by cross posting the same question on a couple of forums. It was not my intention to offend anyone or waste anybodies time and if I have I sincerely apologise.

+ 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