Hi, Try this macro.
Sub kTest() 'Kris @ ExcelFox.com Dim i As Long, j As Long Dim n As Long, m As Long Dim r As Range Dim wbkA As Workbook Dim wbkN As Workbook Dim wksN As Worksheet Dim CopyRng As Range Dim MTHs, SUBs Const MonthCol As Long = 2 'adjust the Col No Const SubCol As Long = 3 'adjust the Col No Const SaveFolder As String = "E:\Test\" '<<==== adjust to suit With Application .ScreenUpdating = False .DisplayAlerts = False End With Set wbkA = ThisWorkbook Set r = Range("a1").CurrentRegion MTHs = GetUniques(r.Columns(MonthCol).Offset(1)) SUBs = GetUniques(r.Columns(SubCol).Offset(1)) With r For i = LBound(MTHs) To UBound(MTHs) For j = LBound(SUBs) To UBound(SUBs) .AutoFilter MonthCol, "=" & CStr(MTHs(i)) .AutoFilter SubCol, "=" & CStr(SUBs(j)) Set CopyRng = .SpecialCells(12) If CopyRng.Rows.Count > 1 Or CopyRng.Areas.Count > 1 Then Set wbkN = Workbooks.Add m = m + 1 On Error Resume Next Set wksN = wbkN.Worksheets(m) If Err.Number <> 0 Then Set wksN = wbkN.Worksheets.Add Err.Clear: On Error GoTo 0 End If CopyRng.Copy wksN.Range("a1") n = wksN.UsedRange.Rows.Count wksN.Range("a2") = 1 wksN.Range("a2").AutoFill Destination:=wksN.Range("A2:A" & n), Type:=xlFillSeries wksN.Range("b:c").EntireColumn.Delete wksN.Name = SUBs(j) Set wksN = Nothing n = 0 End If .AutoFilter Next wbkN.SaveAs SaveFolder & MTHs(i) & ".xls", 51 wbkN.Close Set wbkN = Nothing: m = 0 Next End With End Sub Private Function GetUniques(ByRef r As Range, Optional Crit) Dim Flg As Boolean Dim i As Long Dim UB1 As Long, v v = r.Value2 Flg = Not IsMissing(Crit) UB1 = UBound(v, 1) With CreateObject("scripting.dictionary") .comparemode = 1 For i = LBound(v) To UB1 If Len(v(i, 1)) Then If Flg Then If v(i, 1) = Crit Then .Item(v(i, 2)) = Empty End If Else .Item(v(i, 1)) = Empty End If End If Next GetUniques = .keys End With End Function Kris On Saturday, 25 February 2012 21:31:46 UTC+5:30, Somnath Khadilkar wrote: > > Sir, > Basically I Have rows of info. in 6/7 colm. > depending upon the colm 1 and colm 2 entries i would like to > make colm1 no of files with colm 2 no of sheets in them. I also need > to introduce a S No. in each of the sheets. thats it. > the data of say 100 rows * 7 Colm in a single XL file/sheet will be > SLICED into col1 ffiles of colm 2 sheets with the remaining 3 thru 7 > colm only. Well I need the S No 1 thru as many rows as a NEW Col in > each sheet. > If still unclear I will share a work file. [ I dont know if its called > DOUBLE LOOPING ] > > On 2/24/12, Somnath Khadilkar <khadilka...@gmail.com> wrote: > > Sir, > > > > The MASTER sheet contains 7 - 8 colm. infomation > > viz. > > > > s no month sub name roll > no std mark > > 1 jan math ameya 1 X 10 > > > > what I need is 'months' of files of 'subject' sheets rest all is to be > > put as it is. > > so if there are 12 months and 3 subjects in MASTER all unique, the macro > > should produce 12 distict files [ with name as that of month ] each > > one having 3 sheets each row of these files contain remaining columns > > of MASTER and an addl S No colm. > > so the file jan will contain sheets only 'math' and the rows will be > > > > name roll no std mark > > ameya 1 X 10 > > smita 4 VIII 40 > > indrani 7 IV 70 > > > > I need an addl. colm Sr No. > > so it shus contain > > > > s no name roll no std mark > > 1 ameya 1 X 10 > > 2 smita 4 VIII 40 > > 3 indrani 7 IV 70 > > > > if there are more months the addl sheets should be present. > > > > hope i have given one ex which might thro more light. > > > > =mangal ho > > > > On 2/24/12, dguillett1 <dguille...@gmail.com> wrote: > >> From what you have provided, I have no idea what you want. You need to > >> explain with EXAMPLES. > >> > >> > >> > >> Don Guillett > >> SalesAid Software > >> dguille...@gmail.com > >> -----Original Message----- > >> From: Somnath Khadilkar > >> Sent: Friday, February 24, 2012 9:07 AM > >> To: excel-macros@googlegroups.com > >> Cc: dguille...@gmail.com > >> Subject: $$Excel-Macros$$ Need a small MACRO to SPLIT Double Looping > >> > >> Dear Sir, > >> Pl explain questions in a small para. > >> I am enclosing a file this has col. on which I need separate XL > >> files/sheets made. > >> COLM D Thru F are say dummy.....cud be more also. > >> i) Separate files as per month[ col b ] > >> ii) Separate sheets as per subjects[ col c ] > >> Sheet names I got fro m you [ the unique city , but how to specify > >> file names [ say I need combination of item and say DATE, or a > >> variable... > >> > >> well I need to insert a row "S. No" in each sheet , of alll files [ > >> to be populated 1,2,3... and in COLm 'A' ] [ Here I need say upto > >> first 10 entries , if exists. ] > >> > >> > >> On 2/6/12, dguillett1 <dguille...@gmail.com> wrote: > >>> Glad to help > >>> > >>> > >>> > >>> Don Guillett > >>> SalesAid Software > >>> dguille...@gmail.com > >>> -----Original Message----- > >>> From: Somnath Khadilkar > >>> Sent: Sunday, February 05, 2012 8:43 PM > >>> To: excel-macros@googlegroups.com > >>> Subject: Re: $$Excel-Macros$$ Need a small MACRO to SPLIT > >>> > >>> Many thanks Don Guillett Sir, > >>> You hv done MORE than my requirement. > >>> =mangal ho [ GOD BLESS ] > >>> > >>> On 2/5/12, dguillett1 <dguille...@gmail.com> wrote: > >>>> See Attached to make unique list>filter and copy to new sheets in file > >>>> > >>>> Don Guillett > >>>> SalesAid Software > >>>> dguille...@gmail.com > >>>> -----Original Message----- > >>>> From: Somnath Khadilkar > >>>> Sent: Sunday, February 05, 2012 11:32 AM > >>>> To: excel-macros@googlegroups.com > >>>> Subject: $$Excel-Macros$$ Need a small MACRO to SPLIT > >>>> > >>>> Good even... > >>>> I have attached a sample file.... > >>>> > >>>> depending upon colm A I need to split the whole DATA sheets into > >>>> multiple sheets in the same/diff. file each sheets be named as per the > >>>> COLM 'A', if possible. These entries are from few to many 100 K [ max > >>>> distinct cities < 25, however] > >>>> > >>>> =mangal ho > >>>> > >>>> > >>>> > >>>> Good Morning. > >>>> I receive XL file comprising 1-sheet. Depending upon Colm 'A' I > >>>> need to SPLIT this single sheet into MULTIPLE sheets [ with this colm > >>>> as it name. ] The Distinct entries in this colm. would be less than > >>>> say 25, but the no of entries cud be anything say 10 to 100 K. > >>>> > >>>> Regards > >>>> > >>>> You really need to give us details and send a file with a complete > >>>> explanation. > >>>> > >>>> > >>>> > >>>> Don Guillett > >>>> SalesAid Software > >>>> dguille...@gmail.com > >>>> > >>>> -- > >>>> FORUM RULES (986+ members already BANNED for violation) > >>>> > >>>> 1) Use concise, accurate thread titles. Poor thread titles, like > Please > >>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need > Advice > >>>> will > >>>> not get quick attention or may not be answered. > >>>> > >>>> 2) Don't post a question in the thread of another member. > >>>> > >>>> 3) Don't post questions regarding breaking or bypassing any security > >>>> measure. > >>>> > >>>> 4) Acknowledge the responses you receive, good or bad. > >>>> > >>>> 5) Cross-promotion of, or links to, forums competitive to this forum > >>>> in > >>>> signatures are prohibited. > >>>> > >>>> NOTE : Don't ever post personal or confidential data in a workbook. > >>>> Forum > >>>> owners and members are not responsible for any loss. > >>>> > >>>> > ------------------------------------------------------------------------------------------------------ > >>>> To post to this group, send email to excel-macros@googlegroups.com > >>>> > >>>> -- > >>>> FORUM RULES (986+ members already BANNED for violation) > >>>> > >>>> 1) Use concise, accurate thread titles. Poor thread titles, like > Please > >>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need > Advice > >>>> will > >>>> not get quick attention or may not be answered. > >>>> > >>>> 2) Don't post a question in the thread of another member. > >>>> > >>>> 3) Don't post questions regarding breaking or bypassing any security > >>>> measure. > >>>> > >>>> 4) Acknowledge the responses you receive, good or bad. > >>>> > >>>> 5) Cross-promotion of, or links to, forums competitive to this forum > >>>> in > >>>> signatures are prohibited. > >>>> > >>>> NOTE : Don't ever post personal or confidential data in a workbook. > >>>> Forum > >>>> owners and members are not responsible for any loss. > >>>> > >>>> > ------------------------------------------------------------------------------------------------------ > >>>> To post to this group, send email to excel-macros@googlegroups.com > >>>> > >>> > >>> -- > >>> FORUM RULES (986+ members already BANNED for violation) > >>> > >>> 1) Use concise, accurate thread titles. Poor thread titles, like Please > >>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > >>> will > >>> not get quick attention or may not be answered. > >>> > >>> 2) Don't post a question in the thread of another member. > >>> > >>> 3) Don't post questions regarding breaking or bypassing any security > >>> measure. > >>> > >>> 4) Acknowledge the responses you receive, good or bad. > >>> > >>> 5) Cross-promotion of, or links to, forums competitive to this forum > in > >>> signatures are prohibited. > >>> > >>> NOTE : Don't ever post personal or confidential data in a workbook. > >>> Forum > >>> owners and members are not responsible for any loss. > >>> > >>> > ------------------------------------------------------------------------------------------------------ > >>> To post to this group, send email to excel-macros@googlegroups.com > >>> > >>> -- > >>> FORUM RULES (986+ members already BANNED for violation) > >>> > >>> 1) Use concise, accurate thread titles. Poor thread titles, like Please > >>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > >>> will > >>> not get quick attention or may not be answered. > >>> > >>> 2) Don't post a question in the thread of another member. > >>> > >>> 3) Don't post questions regarding breaking or bypassing any security > >>> measure. > >>> > >>> 4) Acknowledge the responses you receive, good or bad. > >>> > >>> 5) Cross-promotion of, or links to, forums competitive to this forum > in > >>> signatures are prohibited. > >>> > >>> NOTE : Don't ever post personal or confidential data in a workbook. > >>> Forum > >>> owners and members are not responsible for any loss. > >>> > >>> > ------------------------------------------------------------------------------------------------------ > >>> To post to this group, send email to excel-macros@googlegroups.com > >>> > >> > >> > > > -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com