Use this : in Attached Sheet. Sub DistributeDataOnSheets() Dim VarFilterData() Dim objDic As Object Dim wksSheet As Worksheet Dim lngLoop As Long Dim rngRange As Range Dim wkSSheetNew As Worksheet Set objDic = CreateObject("Scripting.Dictionary") Set wksSheet = ThisWorkbook.Worksheets("Sheet1") VarFilterData = Application.Transpose(Intersect(wksSheet.UsedRange, wksSheet.UsedRange.Columns(2).Offset(1))) For lngLoop = LBound(VarFilterData) To UBound(VarFilterData) If Not objDic.Exists(VarFilterData(lngLoop)) Then objDic.Add VarFilterData(lngLoop), VarFilterData(lngLoop) Next lngLoop Application.ScreenUpdating = False For lngLoop = 1 To objDic.Count With wksSheet.UsedRange.Columns(2) .Replace VarFilterData(lngLoop), "" Set rngRange = .SpecialCells(xlCellTypeBlanks) rngRange.Value = VarFilterData(lngLoop) End With Application.DisplayAlerts = False On Error Resume Next ThisWorkbook.Worksheets(VarFilterData(lngLoop)).Delete On Error GoTo 0: On Error GoTo -1 Application.DisplayAlerts = True Set wkSSheetNew = ThisWorkbook.Worksheets.Add wkSSheetNew.Name = VarFilterData(lngLoop) wksSheet.Rows(1).Copy wkSSheetNew.Range("A1") rngRange.EntireRow.Copy wkSSheetNew.Range("A2") Next lngLoop Application.ScreenUpdating = True MsgBox "Done" End Sub
Rajan. -----Original Message----- From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Somnath Khadilkar Sent: Apr/Mon/2012 08:33 To: excel-macros@googlegroups.com Subject: $$Excel-Macros$$ one to many FILES , depeding upon filter condition Dear Sir, MY request is to get the data into MULTIFLE FILES depending upon FILTER Selected. The file names should be say ahm-item-1, ahm-item-2 etc.. [ these will be unique combination] in a subdirectory named say XXYY, which will cotain ALL colms for the selected filters on col. A & B so a unique list of cities say 10, and uniq list of items say 25 could generate upto 250 files. Pl help, attachment enclosed. =mangal ho -- 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
Copy of svk-sample.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12