+ Reply to Thread
Results 1 to 11 of 11

Move sheet and save as cell value

  1. #1
    Registered User
    Join Date
    03-08-2007
    Posts
    24

    Move sheet and save as cell value

    Hello all, great forums!

    I would like to move a sheet from a two sheet workbook, to a new workbook and save the new workbook with a file name from three cell values.

    Stuie had helped me yesterday, and this is what I have so far

    Please Login or Register  to view this content.
    I am getting a syntax error on the last line however, any help would be greatly appreciated.

  2. #2
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    Hey Safecracker...

    The last line of code (C:\Folderr\"& fn) needs a speech mark... eg,

    Please Login or Register  to view this content.
    So the complete code would look like this,

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-08-2007
    Posts
    24

    Thanks...another question please

    Hey Stuie, this works great, thank you very much for your help.

    I have another question on this code, how could I add to the code so when i execute the macro, the original file saves (with the original name) in a specific directory, then the original file closes. Then prior to saving the new workbook, it would lock the new workbook?

    Thanks Again...

    btw the code so far:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-08-2007
    Posts
    24

    Thumbs up I got it thanks!

    Here was the final code and it achieved its desired result.

    Please Login or Register  to view this content.
    Thanks for your help!

  5. #5
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    No Problem M8... Cheers for feedback

  6. #6
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Move sheet and save as cell value

    Hi there,
    I used the code spoken about above but i keep getting run time error, type mismatch on the line "Sheets(Sheet2).Copy" and it highlights it in yellow.
    As you can probably tell i am pretty new to this vba thing and if you could help me out id be so grateful.
    Thanks
    Sean

    heres the code:

    Please Login or Register  to view this content.
    Last edited by arlu1201; 04-11-2013 at 06:27 AM. Reason: Use code tags in future.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Move sheet and save as cell value

    Try changing it to
    Please Login or Register  to view this content.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  8. #8
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Move sheet and save as cell value

    Its now saying run time error, subscript out of range.

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Move sheet and save as cell value

    Check if you have a Sheet2 in your file.

  10. #10
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Move sheet and save as cell value

    I had renamed sheet2 so i changed it to that and it now works.

    Thank you for the help i really appreciate it :D

  11. #11
    Registered User
    Join Date
    04-11-2013
    Location
    Manchester
    MS-Off Ver
    Excel 2007/10
    Posts
    19

    Re: Move sheet and save as cell value

    Perhaps you can help me with this too? you seem pretty clued up on vba XD

    http://www.excelforum.com/excel-prog...58#post3193258

+ 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