+ Reply to Thread
Results 1 to 9 of 9

vba to save file as a new file and record data into existing data sheet

  1. #1
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Microsoft Excel 365
    Posts
    67

    vba to save file as a new file and record data into existing data sheet

    Hi there,
    1. Here is what I want to do with my current excel file:
    2. Click Save button to save all required data to another sheet
    3. The number highlighted in reed need to be auto increment (+1) each time save button is click
    4. Then the file will save as a new excel file with the form number (SRF-ABC-1001-14.xls)
    5. And clear the current form and exit excel


    Please refer my attached file for the sample what I want to do.

    Please note the number highlighted in red should be auto increment number, once click save button, the file will automatic save as a new excel with the Form name.

    Request Form.xlsx

    Please note the number highlighted in red should be auto increment number.

    Thank you so much for your help and time reading this.
    Last edited by lazyserv; 09-28-2014 at 09:50 PM. Reason: updated question

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: vba to save file as a new file and record data into existing data sheet

    Give this a go, change folder location to suite....

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Microsoft Excel 365
    Posts
    67

    Re: vba to save file as a new file and record data into existing data sheet

    Quote Originally Posted by davesexcel View Post
    Give this a go, change folder location to suite....

    Please Login or Register  to view this content.
    I tried the code but I get sub error.

    Anyway I have revised my question, can you please take a look as I provide more clearer what I want to achieve.

    Also here is the attached excel file that got error.

    I would like to learn how to code vba, therefore I hope you able to leave comment on the code above, provide one or two sample coding for what I want to achieve and I'll learn from there.

    Thanks!
    Attached Files Attached Files
    Last edited by lazyserv; 09-28-2014 at 09:51 PM. Reason: added comment

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: vba to save file as a new file and record data into existing data sheet

    Try this code..
    Please Login or Register  to view this content.
    However You can also use SAVECOPYAS insted of SAVEAS, if you meant to save a backup...
    Check the attached file..
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  5. #5
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Microsoft Excel 365
    Posts
    67

    Re: vba to save file as a new file and record data into existing data sheet

    Quote Originally Posted by Vikas_Gautam View Post
    Try this code..
    Please Login or Register  to view this content.
    However You can also use SAVECOPYAS insted of SAVEAS, if you meant to save a backup...
    Check the attached file..
    Hi there, I tested but it show me error.

    Please refer attached excel form.xlsm

    Apart from that, can you assist me by showing me how to store the data to the database sheet?

    Basically this is a master form whereby all the new file name save will generate a copy of backup for future reference.

    Also is it possible to make the module when click it save and clear all the content enter and exit this form?

    Thank you so much for your help

  6. #6
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: vba to save file as a new file and record data into existing data sheet

    The code is working for me...
    May be you have to change the Folder in the code...

    Regards,

  7. #7
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Microsoft Excel 365
    Posts
    67

    Re: vba to save file as a new file and record data into existing data sheet

    Quote Originally Posted by Vikas_Gautam View Post
    The code is working for me...
    May be you have to change the Folder in the code...

    Regards,
    Ok, how bout save the data in database sheet? do you able to advise what is the code need in order to save the current sheet data to database sheet data?

    Thanks

  8. #8
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: vba to save file as a new file and record data into existing data sheet

    what is meant by database sheet here...?

  9. #9
    Registered User
    Join Date
    04-30-2014
    Location
    england
    MS-Off Ver
    Microsoft Excel 365
    Posts
    67

    Re: vba to save file as a new file and record data into existing data sheet

    Quote Originally Posted by Vikas_Gautam View Post
    what is meant by database sheet here...?

    Hi please refer below image:

    \1

    And the attached file which I highlighted in blue, how do I save the column data I want to the worksheet that name as Database?

    form.xlsx

    Thanks.

+ 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] VBA Help need for pullout data to new sheet from Master Sheet & save as new file (UserForm
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 01-19-2013, 06:01 PM
  2. Writing a file’s name (or renaming it ) based on existing excel sheet data
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-30-2012, 08:11 PM
  3. Copy Data from Closed File to Existing File
    By srikanthbenoni in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2012, 08:36 AM
  4. How to: Open file, format data, save file, close file and repeat.
    By thexeber in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2010, 12:56 PM
  5. Replies: 2
    Last Post: 02-18-2005, 10:06 AM

Tags for this Thread

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