Consulting

Results 1 to 4 of 4

Thread: Solved: Save Active Worksheet

  1. #1
    VBAX Regular
    Joined
    Jun 2005
    Posts
    11
    Location

    Solved: Save Active Worksheet

    This is probably a very simple one but it's got me stumped!

    I've got a workbook which contains a number of sheets. All I want to do is create a new workbook with just one of the sheets in it (it'll be the active sheet) and save this to a specified location.

    I thought it would be easy to do with VBA but I just can't think how to do it.

    Thanks for your assistance

    Martin

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    You're right, it is simple but,to be fair, not exactly obvious...
    When you use Copy on a worksheet with no paramaters (to tell it where), it copies to a new workbook.[VBA]ActiveSheet.Copy[/VBA]
    The new workbook will then be the active one and you can go on to use .SaveAs with a path or show the Save As... dialog
    K :-)

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by mpewsey
    This is probably a very simple one but it's got me stumped!

    I've got a workbook which contains a number of sheets. All I want to do is create a new workbook with just one of the sheets in it (it'll be the active sheet) and save this to a specified location.

    I thought it would be easy to do with VBA but I just can't think how to do it.

    Thanks for your assistance

    Martin
    [vba]
    Activesheet.Copy
    ACtiveworkbook.SaveAs filename:="soomething"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Jun 2005
    Posts
    11
    Location
    Many thanks for your help

Posting Permissions

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