+ Reply to Thread
Results 1 to 2 of 2

How to make changes in a new workbook opened from an active workbook

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    How to make changes in a new workbook opened from an active workbook

    Iam using the following code to save a range in the active workbook into a new workbook.
    Please Login or Register  to view this content.
    This works fine as long as the line EditSheet SheetName is excluded. If it is used then I get a message "subscript out of range" because of course there is no sheet called sheetname in the new workbook.
    I am sure there must be a simple way out of this out of this corner, but I can't find it.
    Can anyone help please.
    John

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to make changes in a new workbook opened from an active workbook

    Assuming EditSheet expects a worksheet object, it's not clear from the context...

    Please Login or Register  to view this content.
    But, on re-reading it, nothing is clear.

    Which worksheet do you want to edit? What's the code for EditSheet. especially the declaration?

    You really should not rely on ActiveWorkbook or ActiveSheet - there are times, probably like now, when it is not clear what the active workbook is.

    For example:
    Please Login or Register  to view this content.
    Last edited by cytop; 02-22-2017 at 10:57 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Getting an error when trying to make a workbook opened from sharepoint active
    By GreenTee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2015, 06:36 PM
  2. Make VBA run triggered when workbook is opened
    By Muzza86 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2014, 06:38 AM
  3. [SOLVED] Code to open a another workbook from a macro, but have it opened and not be the active
    By scottatbuckman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-19-2014, 03:43 PM
  4. [SOLVED] Code to detect previous active workbook instead of current active workbook
    By kosherboy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-25-2014, 01:58 AM
  5. Replace all data in active workbook with all data from an opened workbook
    By krisspy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-18-2014, 04:12 PM
  6. Use a macro to extract cell data from opened workbook to new opened workbook
    By BrianTFC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2014, 01:35 PM
  7. Make newly opened workbook the active workbook
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2011, 10:12 AM

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