+ Reply to Thread
Results 1 to 8 of 8

Command button to open Save As dialogue box for new spreadsheet and copy data.

  1. #1
    Registered User
    Join Date
    12-18-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    16

    Command button to open Save As dialogue box for new spreadsheet and copy data.

    Good morning,
    I have a spreadsheet that I'd let to set up with a Command button on one sheet that will open a Save As dialogue box for a new spreadsheet and then copy data from another sheet to the new sheet when being saved.

    Thank you
    Jim

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    Jim

    To get the Save as dialog you can use Application.GetSaveAsFilename.

    Not really clear to me what you want to do from there.

    Do you want to create a new, blank worksheet, copy data to it from the sheet/workbook with the command button, and then save it with the filename from Application.GetSaveAsFilename.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    12-18-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    Hi Norie,
    I'd like this button to the SaveAs filename box. When the file is saved, I'd like all data from populated fields in another sheet saved to the new excel document automatically. I hope that makes sense.

    Jim

  4. #4
    Registered User
    Join Date
    12-18-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    I was able to get the command button working to open a new save as dialogue box, just need to figure out how save the values of my 3rd sheet of my workbook to the new excel file.

    Thanks
    Jim

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    Jim

    Can you post what you have so far?

    Also, what values do you want to copy and where do you want to copy them to in the new workbook?

  6. #6
    Registered User
    Join Date
    12-18-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    This is what I have so far...

    Private Sub CommandButton1_Click()

    Set NewBook = Workbooks.Add
    Workbooks("Crew_Hours_Tracking_Sheet-_rev1_122013 (1).xlsx").Worksheets("Violations").Range("A1:C62").Copy
    NewBook.Worksheets("Sheet1").Range("A1").PasteSpecial (xlPasteValues)

    End Sub

    I'm also worried that if the file name is changed that the Workbook listed won't change too.

    Thanks
    Jim

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    Jim

    What workbook is 'listed'?

    PS Can you use code tags when posting code?

  8. #8
    Registered User
    Join Date
    12-18-2013
    Location
    Seattle
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Command button to open Save As dialogue box for new spreadsheet and copy data.

    Yes I will give it a shot. The workbook listed in the code is Crew_Hours_Tracking_Sheet-_rev1_122013 (1).xlsx.

+ 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. How to wrie a macro to create a dialogue box with a command button?
    By roopa m j in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2013, 01:59 AM
  2. [SOLVED] command button: specified sheet copy and save as new workbook to specified location
    By Zlatko.Pan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-15-2013, 12:28 PM
  3. [SOLVED] VBA code to 'click' Open in the Open or Save dialogue box on a webpage?
    By bensox in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-31-2012, 05:40 AM
  4. command button- open folder and copy data from .csv file
    By karo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2012, 08:17 AM
  5. Command button - to copy active sheet and not save current workbook
    By vjboaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-22-2008, 05:23 PM

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