sure,

these macros should work.
they assume that the sheet with the data is called "Data"
and you want to copy the row from column "A" to "Z"

the second macro deletes all sheets except for "Data"..
so, be careful.  if you have more sheets that you want to 
keep, you'll have to modify the macro.
If your Data sheet isn't called "Data", you'll have to 
modify BOTH macros.

Option Explicit
Sub Segregate_Data()
    Dim nRows, sRows, sht, Usr, R, modcnt
    Application.ScreenUpdating = False
    
    nRows = 
Application.WorksheetFunction.CountA(Sheets("Data").Range("A1:A65000"))
    For R = 2 To nRows
        If (R Mod modcnt = 0) Then Application.StatusBar = "Processing " & 
Int(R / nRows) * 100 & "% of " & nRows & " Records"
        Usr = UCase(Sheets("Data").Cells(R, "A").Value)
        If (Usr & "X" <> "X") Then
            For sht = 1 To Sheets.Count
                If (UCase(Sheets(sht).Name) = UCase(Usr)) Then Exit For
            Next sht
            If sht > Sheets.Count Then sht = Sheets.Count
            If (UCase(Sheets(sht).Name) <> UCase(Usr)) Then
                Sheets.Add after:=Sheets(Sheets.Count)
                ActiveSheet.Name = Usr
                Sheets(Usr).Range("A1:Z1") = Sheets("Data").Range("A1:Z1").Value
                Sheets("Data").Select
            End If
            sRows = 
Application.WorksheetFunction.CountA(Sheets(Usr).Range("A1:A65000")) + 1
            Sheets(Usr).Range("A" & sRows & ":Z" & sRows) = 
Sheets("Data").Range("A" & R & ":Z" & R).Value
        End If
    Next R
    Application.ScreenUpdating = True
    MsgBox "Processed " & nRows - 1 & " Rows"
End Sub
'--------------------------------------------------
Sub clearsheets()
    Dim sht
    Application.DisplayAlerts = False
    For sht = Sheets.Count To 1 Step -1
        If UCase(Sheets(sht).Name) <> UCase("Data") Then Sheets(sht).Delete
    Next sht
    Application.DisplayAlerts = True
End Sub


hope this helps,

paul




________________________________
From: Chanti-Hyderabad <ramesh1...@gmail.com>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Tue, November 3, 2009 8:25:25 AM
Subject: $$Excel-Macros$$ Segregate data in appropriate sheet with Name as 
sheet name


Hi Team,

Is there a way we can segregate the data depending upon the name
(column A) to different tabs.

Example
If it is a macro, and if I run it, the result would be:

Sheet names:  “Ramesh”, Ravi”, “Rakesh”, and “Sridhar” and each tab
would contain the data as per the sheet name.

I hope this is a confusing request, please let me know if you have any
questions.

Thanks in advance
Ramesh


--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to