Saving one sheet in a workbook

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Saving one sheet in a workbook

  1. #1
    Board Regular JG71's Avatar
    Join Date
    Oct 2002
    Posts
    107
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    Hello,
    Is it possilble to have the information in a workbook save one or more sheets and not save others? Thanks

  2. #2
    Board Regular
    Join Date
    Oct 2002
    Location
    Turkey
    Posts
    1,022
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    i guess no, unless you create a new workbook and copy the needed sheets to this new woorkbook via VBA

  3. #3
    Board Regular
    Join Date
    Jun 2002
    Location
    Perth, Australia
    Posts
    1,416
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Put the following macro in a standard module.

    The macro saves sheet2 and sheet4 to the C:My DocumentsTemp directory. Change to suit (add more lines to the macro if you wish to save more sheets).


    Sub CopySheets()

    Dim NWB As Workbook ' New Workbook
    Dim NewName As String
    Dim OWB As Workbook ' Old WorkBook
    Dim dPath As String
    dPath = "C:My DocumentsTemp" 'Change to suit

    Application.ScreenUpdating = False

    NewName = ""
    NewName = InputBox("Enter New Book Name without .xls")

    Set OWB = ActiveWorkbook
    Set NWB = Workbooks.Add

    OWB.Sheets("Sheet2").Copy NWB.Sheets(1)
    OWB.Sheets("Sheet4").Copy NWB.Sheets(1)


    NWB.SaveAs FileName:=dPath & NewName + ".xls"
    Application.ScreenUpdating = True

    End Sub




    HTH

    Mike




    [ This Message was edited by: Ekim on 2002-11-01 19:49 ]

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com