I was wondering if there was a way to get all the different AutoFilter criteria in one list for each criteria , in the copy of the end and pasting each separate table which appears as a separate sheet such as it is turned on. Ideally it will run n times: Where N is the number of different variables. I want to emphasize that how to copy and paste in the macro, but I was curious how to repeat all the different norms because the norms vary on the basis of day May be. If a list is not available then how would I go through the criteria again? You can study and customize This means that when you press Ctrl-End to go to the last-used cell, then more is required. You can find a way to resolve the matter if necessary;) BTW I do not intend to modify it for my specific file; It's something you should do (or give it to ;;)). BTW This can be done using the normal (rather advanced) filter. You still copy the columns and delete the duplicates. Added : Well, I felt motivated to get myself also with Autofilter: [Both processes can be improved by using defined names and some error handling / probes.]
ActiveSheet.Range (AllRows) .AutoFilter field = 10, Criterion 1: = CritVariable
sub SheetsFromFilter () Dim wsCurrent Worksheet dim wsNew Worksheet dim iLeft integer set wsCurrent = ActiveSheet Application.ScreenUpdating = false as for as the range (.. "G5", range ( "G5") and (xlDown)) copy range ( "W1") range ( "W1") CurrentRegion.RemoveDuplicates column: .. = 1, Header: = xlYes iLeft = Range ("W1") .coreant region. ROSCount - 1 while iLeft & gt; 0 wsCurrent.Range ("A5") CurrentRegion.AdvancedFilter xlFilterCopy, _wcsCurrent.Range. ("W1: W2"), wsCurrent.Range ("Z1") set wsNew = Worksheets.Add wsCurrent.Range ("Z1"). CurrentRegion.Cut wsNew.Range ( "A1") wsNew.Name = wsCurrent.Range ( "W2") value wsCurrent.Range ( "W2") Delete xlShiftUp iLeft = iLeft - .. 1 loop wsCurrent.Range ("W1"). Skip application. ScreenUpdating = True End Sub
sub SheetsFromAutoFilter () as dim wsCurrent Worksheet set dim wsNew worksheet integer as dim iLeft wsCurrent = ActiveSheet Application.ScreenUpdating = false range ( "G5", range ( "G5"). End (xlDown )) In form of. Copy range ("W1".) Range ("W1") CurrentRegion.RemoveDuplicates column: = 1, Header:. = XlYes iLeft = Range ("W1") CurrentRegion.Rows.Count - 1 while Do iLeft & gt; 0 set wsNew = Worksheets.Add wsCurrent.Range ("A5") CurrentRegion .With the AutoFilter area: .. = 7, _ Criteria1: = wsCurrent.Range ( "W1") Offset (iLeft) .Value .Copy wsNew.Range ( "A1") offset wsNew.Name = wsCurrent.Range ( "W1") with Kotofiltr End (ILeft). Value iLeft = iLeft - 1 loop wsCurrent.Range ("W1"). CurrentRegion.Clear application.ScreenUpdating = True last sub
No comments:
Post a Comment