+ Reply to Thread
Results 1 to 4 of 4

how to close a workbook without saving a individual worksheet?

  1. #1
    Registered User
    Join Date
    08-28-2007
    Posts
    4

    how to close a workbook without saving a individual worksheet?

    Hi

    I am a beginner in VB or Excel. I am doing some data entry stuff in my company.

    here is my problem:

    I have 2 work sheets in the workbook. my code changes the 1st sheet and adds new information to the 2nd sheet. I want to close the workbook without saving the sheet1 (I want to save the sheet2).

    I used this code: activeworkbook.close savechanges:=false but this applies to whole workbook.

    Can anyone help me in solving this problem?

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    I'm not aware of any way to save just one sheet in a workbook. You could have the macro create a new workbook and copy sheet2 to that workbook and save it, though.

    Another option would be to copy sheet1 upon opening the workbook, to say sheet3, then doing your work on sheets 1 and 2, then replacing sheet1 with sheet3 (delete sheet1, rename sheet3 to sheet1). Then save.

  3. #3
    Registered User
    Join Date
    08-28-2007
    Posts
    4
    Can you give the exact code to copy a sheet into a new sheet in the current workbook?


    I tried this : sheet1.copy after:="sheet2" ............................
    ........................
    ........................
    sheet2.delete

    but it is resulting in an "object required" error

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885
    Something like..
    Please Login or Register  to view this content.

+ 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