excel - Apply macro filter across Multiple worksheet in a workbook and and save the filtered value as another workbook containing those multiple sheet -


I have a workbook that has 23 working papers, allowing me to filter the data from 23 work sheets to the macro auto filter And those data will be saved as work book along with the filtered data in those 23 worksheets. sub-switch_filter (), as integer, as integer, integer As, integer as i am full As a result, as a whole, as well as an integer, as in as integers, fractions, s1, variant j = Worksheets. Number s = input box ("enter switch id") s1 = s & amp; ; "*" If the S & lt; & Gt; For VbNullString again with K = 1 to 20 if (k & lt; & gt; 1) and (k & lt;> 4) and (k & lt;> 7) then with worksheets (k). UsedRange.AutoFilter field: = 3, Criterion 1: = s1 LastRow =. Call (.Rows.Count, "A"). End (xlUp). LastRow range for I = 3 (cell (i, 1), cells (i, 36)). Select the selection .copy workbook. Open filename: = "C: \ user \ takyar \ documents \ salesmaster-new.xlsx" worksheet (k). Select Erow = ActiveSheet.Cells (rows number, 1). End (xlUp) .offet (1, 0) .ro ActiveSheet.Cells (Arrow, 1). Select ActiveSheet.Paste ActiveWorkbook Save ActiveWorkbook Close the application CutCopyMode = False Next I End End End If the next K End End End End Sub

is almost full, but it saves the filtered data in the same sheet of the new workbook, I have attached: -

  sub switch_filter () Integer like dim j, as integer dim as integer in the form of last row, i variant varies, s1 In the version of the slow MyWorkbook workbook, the workbook Set up a new work in the form in MyWorkbook = ThisWorkbook j = Vrkshitskkount s = InputBo X ( "Enter list ID") s1 = s & amp; "*" If the S & lt; & Gt; For VbNullString, set = 1 to 20 worksheets (K) with MyWorkbook = ThisWorkbook if (k & lt;> 1) and (k & lt;> 4) and (k & lt; & gt; 7) Then AutoFilterMode = False with Worksheets (K). Autofilter. Autofilter. Autofilter Field: = 3, Finish with criteria 1: = s1 End MyWorkbook.Sheets (k) .Row ("1: 65000"). Copy with NewWork = Workbooks.Open ("E: \ spreed Sheet \ sample1.xlsx"). Worksheets (K) range ("A2"). Paste Special Paste: = XLPistNow new work End & P> pls with Android suggests a solution to me.  

Thanks in advance .... !!!

Not even sure that it is being executed, you were not really saying that your Where is the error happening

Without that information, I think the biggest problem is that you are copying one line at a time and every time you want to copy that line, you get a workbook Are opening and closing

If you want the new workbook to keep all the different sheets with the filtered data, then you may want to consider creating a new worksheet within the old document, only the filtered data Together and at one time you can move / cut it into a whole new sheet in the new document. - There is something that you could learn to write code manually by writing a macro recording.

Otherwise, if you can store this data in 1 sheet / table, then I recommend loading each worksheet with its filtered data in a single array and then opening a new workbook and opening it Write all the information from the array. This option can be the fastest.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -