+ Reply to Thread
Results 1 to 4 of 4

Thread: Create new workbooks named after each cell in column A

  1. #1
    Valued Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    232

    Create new workbooks named after each cell in column A

    I have a bunch of company names and blank cells in column A. I wish to create a new workbook for each company name.
    Software & Op system: Office 2010, Acrobat X Pro, Windows 7

  2. #2
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create new workbooks named after each cell in column A

    Hi Xx7,

    Use the following code:-

    
    Sub WkBk()
    o = ActiveWorkbook.Name
    Cells(1, 1).Select
    k = Range("a65536").End(xlUp).Row
    For n = 1 To k
        i = ActiveCell.Value
        If i <> "" Then
            Application.Workbooks.Add
            ActiveWorkbook.SaveAs (i)
            Windows(o).Activate
            ActiveCell.Offset(1, 0).Select
        Else
        ActiveCell.Offset(1, 0).Select
        End If
    Next
    End Sub
    Sample file is also attached. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    Attached Files Attached Files
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  3. #3
    Valued Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    232

    Re: Create new workbooks named after each cell in column A

    that's great. Is there anyway to save them to a folder instead of opening them?

    Thanks!
    Software & Op system: Office 2010, Acrobat X Pro, Windows 7

  4. #4
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,398

    Re: Create new workbooks named after each cell in column A

    you are welcome Xx7,

    Change the below line in code:-

    ActiveWorkbook.SaveAs (i)
    to

    ActiveWorkbook.SaveAs ("C:\Users\DILIPandey\Downloads\" & i)
    Where path is "C:\Users\DILIPandey\Downloads\" and you need to just change this path to your choice.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

+ 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.2.0