+ Reply to Thread
Results 1 to 18 of 18

open workbook then save as different workbook dependant on a1

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    open workbook then save as different workbook dependant on a1

    hi guys is it possible to work on a workbook lets call it 123

    once macro button is pressed it opens workbook abc

    then saves it as what ever is in cell a1 to a directory?

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    Which workbook are you saving & which workbook contains the name?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    sorry roy
    wasnt very specific was i

    the workbook im working on is workbook "hello" so i will open that automatically , i will then go about my work and press macro button which should then open "please" from directory "C:\Documents and Settings\st\Desktop"
    it will then copy cells a1 and b1 to the corresponing cells a1 and b1 in "please"
    it then needs to save that "please" as whatever is in cell a1 so lets say cell a1 has abc123 in it
    it will save the workbook as "abc123 - please" to the same directory

    thank you

  4. #4
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    hi roy
    this is the code i already have
    which as you can already see it does open another workbook already
    ( i want it to open 2 and put different stuff into "please" and then rename it

    Please Login or Register  to view this content.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    You have the code for opening & getting values, you just need to amend it to suit the other workbook.

    You can then save the updated sheet like this
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    thanks roy
    will take a look when i have woken properly

  7. #7
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    roy or anyone kind enough to help
    is it possible to use this line twice?
    Please Login or Register  to view this content.
    but to use a different workbook?
    ie goodbye is the first one
    then use please?

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    You can reset the variable wbTo later in the code if you want
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    i dont quite fully understand what you are saying roy
    can i use that line twice to open two workbooks at the same time?

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    No you need to use the variable to do the copying as in your code, then you can reset the variable as in my code extract. If yo change it to the second workbook then the code will ignore the first one opened.Otherwise you need a second variable wbToA or omething then use that

  11. #11
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    thanks roy for your help
    i just understand what you are saying
    not to worry thanks all the same

  12. #12
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    roy
    i have got some of the way there
    its all a lot of unnecessary coding probably but it seems to work
    i have this so far
    it opens both workbooks as required and transfers certain cells.
    im still playing eith exactly what i need for each one.


    Please Login or Register  to view this content.

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    Quote Originally Posted by excellentexcel View Post
    thanks roy for your help
    i just understand what you are saying
    not to worry thanks all the same
    sorry, do you understand about the variable?

  14. #14
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    i dont understand
    but some way or another ive managed to get it to do half what i want so i will try a bit more

  15. #15
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    Can you explain why you need to use it twice?

  16. #16
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    i need it to open two new workbooks so that it enters the data i need in the 2 seperate workbook as well as the curent workbook because they are diffe rent books used by different people and saves a lot of input time

  17. #17
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open workbook then save as different workbook dependant on a1

    So you want to open two workbooks & input the same data into both? Something like this might work, you will need to make the change where I have indicated & test it.
    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: open workbook then save as different workbook dependant on a1

    hi roy
    no
    its not the same data but a variation of the same data
    ie
    there may be 50 cells of data in the original
    i then use lets say 20 of the cells for workbook 1
    and then 8 for workbook 2

    the code i put up works

    i just need it to save as specific now which is what im playing around with

+ 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