+ Reply to Thread
Results 1 to 4 of 4

VB code for newest sheet

  1. #1
    Registered User
    Join Date
    03-31-2008
    Posts
    3

    VB code for newest sheet

    Heya All,

    I currently have this code:

    ActiveCell.Columns("A:M").EntireColumn.Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet30").Select
    ActiveCell.Offset(0, 1).Range("A1").Select
    ActiveSheet.Paste

    but instead of "Sheets("Sheet30").Select" i want it to be the newest sheet
    any ideas??

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Contributor
    Join Date
    03-25-2008
    MS-Off Ver
    Excel, Outlook, Word 2007/2003
    Posts
    245
    If you're not going to rename your sheets. Try this
    Please Login or Register  to view this content.
    .

  4. #4
    Registered User
    Join Date
    03-24-2008
    Location
    Calabar, Nigeria
    MS-Off Ver
    2003, 2007
    Posts
    37
    If the you want the last sheet you can use Sheets(Sheets.Count).Select. If your last sheet is not your newest sheet and you really need the newest sheet, you need a permanent store (like a cell) to store the index of the last sheet created.

    The following code should be pasted in the workbook object module. you must have a sheet (preferably hidden) with code name MetaDataSheet and in the sheet a cell named LatestSheetIndex

    Please Login or Register  to view this content.
    You can then use Sheets(MetaDataSheet.Range("LatestSheetIndex")).Select

+ 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