+ Reply to Thread
Results 1 to 9 of 9

Macro for splitting separate files.

  1. #1
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104

    Macro for splitting separate files.

    Hi Team,

    I am new to this forum and I am learning Excel codes in VB. I am just a fresher and require your guidance in developing the below requirement.

    I work in a customer service industry and doing MISS for all customers. The requirement is that each day I will have to manually save separate excel sheet with a client name and individually mail them.
    This activity gets. Repeated again and again and I am spending one hour for this activity.

    How do I group is that I will concatenate both customer code and customer name, then sort by concatenate and group the same customer and copy them and paste to a new sheet and save them in a drive.(you can refer status in Column E in my attached sheet.

    Then if we do not have mutiple customer I will have to create a separate sheet for the reamining ones.

    So can anyone help to create to automatically group the customers and split them into new sheets and save them with customer name. So once the file gets generated, we need to send mails from the same sheet.

    The documents with customer name should be split with the header title and corresponding row of that customer name.

    Your assistance is greatly appreciated !!!!
    Attached Files Attached Files
    Last edited by Santhi28595; 07-01-2019 at 12:15 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: How to split files and send mails based on customer

    In the future please limit your title to a description of what you are trying to do
    "Need help", "assistance required",etc... are not needed, as that is why one posts on the forum.
    I corrected it for you this time

  3. #3
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104

    Re: How to split files and send mails based on customer

    Sorry I will correct next time.

    Thank you

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: How to split files and send mails based on customer

    No problem - Thanks

  5. #5
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104
    Quote Originally Posted by Pepe Le Mokko View Post
    No problem - Thanks
    Can you help me in creating the macro please !!!

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: How to split files and send mails based on customer

    Administrative Note:

    We don't expect you to bump threads more than once in 24 hours - it has been only 5-6 hours since you posted. Please remember that those who help here do so voluntarily and of their own goodwill. They live in many different time zones and many will be out at work right now if they are not asleep on the other side of the globe. This is not a paid 'service': members will help when they are ready and able to do so, and not 'on demand'. Please do not try to put pressure of time on anyone here: if you get the help you need today, that's fine, but you really should not count on it. Thanks for your understanding and patience.

  7. #7
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104

    Re: How to split files and send mails based on customer

    Hi - Noted and thanks

  8. #8
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104

    Re: How to split files and send mails based on customer

    Dear friends,

    Can anyone please help me. It's a request please..
    Last edited by Santhi28595; 07-01-2019 at 12:16 PM.

  9. #9
    Forum Contributor
    Join Date
    04-24-2019
    Location
    Chennai
    MS-Off Ver
    MS office 2007
    Posts
    104

    Re: Macro for splitting separate files.

    Hi I just found the below code from this forum. Can anyone please help me to.modify this code to my criteria.

    Sub CreateFiles()
    Application.ScreenUpdating = False
    Dim LastRow As Long, srcWB As Workbook, srcWS As Worksheet, RngList As Object, key As Variant
    Set srcWB = ThisWorkbook
    Set srcWS = srcWB.Sheets("Page")
    LastRow = srcWS.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    With srcWS.Sort
    .SortFields.Clear
    .SortFields.Add key:=srcWS.Range("A2:A" & LastRow), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .SetRange srcWS.Range("A2:F" & LastRow)
    .Header = xlYes
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
    End With
    Set RngList = CreateObject("Scripting.Dictionary")
    For Each Rng In srcWS.Range("A3", srcWS.Range("A" & srcWS.Rows.Count).End(xlUp))
    If Not RngList.Exists(Rng.Value) Then
    RngList.Add Rng.Value, Nothing
    End If
    Next
    For Each key In RngList
    With srcWS.Cells(1, 1).CurrentRegion
    Sheets(Array("Cover", "Intro", "Page")).Copy
    With Sheets(3).Cells(1, 1)
    .AutoFilter 1, "<>" & key
    .Range("A3:K" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    .AutoFilter
    End With
    .AutoFilter
    End With
    With ActiveWorkbook
    .SaveAs srcWB.Path & Application.PathSeparator & "Category " & key & ".xlsb", FileFormat:=50
    .Close False
    End With
    Next key
    Application.ScreenUpdating = True
    End Sub

+ 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] Send outlook mail based on a today's date and customer name
    By manieldunk in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-20-2018, 02:04 PM
  2. [SOLVED] Assistance Required - Using VBA to send reminder emails.
    By tf1989123 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-14-2016, 07:01 AM
  3. Replies: 1
    Last Post: 01-26-2016, 01:42 PM
  4. How to Send automated mails with attachment files saved in a folder?
    By yemnirmal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2014, 03:16 PM
  5. Macro required to split in to Multiple files
    By gsikumar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2012, 08:23 AM
  6. Reflecting the data from one sheet to another based on condition and to send mails
    By anchuri_chaitanya in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 05-19-2012, 09:25 AM
  7. Send mails attaching files with HTML body range of content
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-16-2011, 09:55 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