+ Reply to Thread
Results 1 to 22 of 22

worksheet split based on the name of the cell

  1. #1
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    worksheet split based on the name of the cell

    I have a worksheet that has multiple information with difference client and I want to tab it out to new sheet when the cell contains a specific name on the first 10 left characters.
    Then I want each of these sheets to page layout as print when it reaches the last row and last column to print out as page fit into PDF file.
    And then to filename by current month and year and specific cell with another another cell that contains a company name. for instance, cell a7 is Mike and if cell g4 contains a company of my list lets say the cell shows "JP Morgan Exchange" and it is on my list as JP Morgan, then filename the pdf file as "Mike_JP Morgan~April 2016" and I want this save in the current folder where the spreadsheet reside.

  2. #2
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    I have researched this forum. the only part I found was relating to Filename. I can see that it would be better to tab out when a specific cell in the sheet contains the first ten left characters then tab in a new sheet by naming it by a cell value in A7. then when we filename it, it will name the file easily this way with the other criteria mentioned above. I did find this VBA but when it exported as PDF in the folder, it won't allow it open. So that means i can't just type ".pdf"?

    By the way, the macros only work on the worksheet that I created the Macro workbook. I want this Macro to work in any workbook that I open. I forgot how to do that? or maybe the language needs to include a statement to allow the macro to run on the workbook that I have open.

    I still need to split workbook though and to print the layout the page to fit into PDF.

  3. #3
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Please Login or Register  to view this content.
    The code above works good but it is only for file naming but it doesn't let me open the pdf when saved. I want to manipulate this code to perform exactly how I wanted in my criteria mentioned above. Maybe you can provide a brand new one. By the way, the macros only work on the worksheet that I created the Macro workbook. I want this Macro to work in any workbook that I open. I forgot how to do that? or maybe the language needs to include a statement to allow the macro to run on the workbook that I have open.

    I still need to split workbook though and to print the layout the page to fit into PDF.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: worksheet split based on the name of the cell

    Hi,

    There's an Application File Save As option associated with saving a pdf that determines whether the file should be opened as a pdf after publishing. Set your Excel app for this to 'Open pdf'

    Put the macro in your Personal Workbook so that it will work at any time.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Hi Richard,

    How do I add that into the macro? and how do I do that? I am very basic excel guy. It has been years since I played with Macros.

  6. #6
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Hi I am sorry but this doesn't really help me. what do you mean? I have been research other process but this is one the other half of the project. Can you explain or copy the vba with what you intended to say. please

  7. #7
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    Use the following code
    Please Login or Register  to view this content.
    Instead of
    Please Login or Register  to view this content.
    Last edited by sanram; 08-10-2016 at 07:48 PM.

  8. #8
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Thank you, it works good but why is it opening new workbook from each tab? I love it that it was able to save each tab into PDF.
    But I dont need each tab in workbook saved or open.

    Please Login or Register  to view this content.

  9. #9
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    Quote Originally Posted by preciouslife73 View Post
    Thank you, it works good but why is it opening new workbook from each tab? I love it that it was able to save each tab into PDF.
    But I dont need each tab in workbook saved or open.

    Please Login or Register  to view this content.
    Then simply change
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    I changed it but still keeps the worksheets open after saving into PDF.

  11. #11
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    Quote Originally Posted by preciouslife73 View Post
    I changed it but still keeps the worksheets open after saving into PDF.
    Do you want to close the worksheet after saving as PDF and open the pdf?

  12. #12
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Right I want to close the worksheet after saving as PDF but also not open the PDF.

  13. #13
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    Quote Originally Posted by preciouslife73 View Post
    Right I want to close the worksheet after saving as PDF but also not open the PDF.
    Add the following line before End Sub :
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    it is asking me if I want to save it. I dont want it to ask me to save it because I dont want to save it.

  15. #15
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    Quote Originally Posted by preciouslife73 View Post
    it is asking me if I want to save it. I dont want it to ask me to save it because I dont want to save it.
    Delete this line. That's it.
    Please Login or Register  to view this content.

  16. #16
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    I am sorry, this seems to be working so great that I want declare this solved but it is still asking me if I want to save each workbooks after saving as pdf. for instance, my workbook has 10 tabs (sheets) and when each of these have already been saved as pdf, each of these converted sheets as workbooks remained open prompting me if I want to save each of them. I have to close ten workbooks by saying no each time.

  17. #17
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    I have tested your code and make the correction. Please see the red colored :
    Please Login or Register  to view this content.
    Last edited by sanram; 08-13-2016 at 09:08 AM.

  18. #18
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    It only closes one workbook not the rest.

  19. #19
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    But I have tested this code on my system and it's working fine. Can you upload a sample file?

  20. #20
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    I see what you mean. It works good. Thank you! I just need to figure out to use this macro to work for whatever workbooks I open to perform this because this macro is only doing it for this workbook.

  21. #21
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: worksheet split based on the name of the cell

    This code should work on any workbook. There remain only one thing in that code that can be changed which is "ws.Range("A1").Value", if you want to change this.

  22. #22
    Forum Contributor
    Join Date
    12-21-2011
    Location
    MS, USA
    MS-Off Ver
    Excel 2013
    Posts
    119

    Re: worksheet split based on the name of the cell

    Great 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. I would like to split one worksheet into many files based on criteria in two columns
    By paulfields4 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2015, 07:34 PM
  2. [SOLVED] How to split worksheet into multiple worksheets based on column content
    By Laurelmzitney in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-03-2014, 10:57 AM
  3. Split Worksheet into Workbooks based on a column value
    By Amarjeet Singh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2014, 07:09 AM
  4. Split a Worksheet into multiple Worksheets based off the DATA-SUBTOTAL
    By znpnh in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-18-2014, 04:06 PM
  5. How to split worksheet into multiple worksheets based on column content
    By jjexcels in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 11-05-2013, 11:42 AM
  6. [SOLVED] Trying to split worksheet based on contents of a column
    By hales8181 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2013, 09:25 AM
  7. [SOLVED] Split Workbook into Multiple Files based on Worksheet Name + Cell Value
    By CRW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-11-2012, 07:05 AM

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