Endless Loop

nniedzielski

Well-known Member
Joined
Jan 8, 2016
Messages
598
Office Version
  1. 2019
Platform
  1. Windows
I seem to have stuck myself into an endless loop, and i cannot seem to figure out where or why this is happening.

VBA Code:
For i = 1 To UBound(Items, 1)
        x = 2
            For Each Item In ArrayDictionaryofItems.keys
            Sheets("Data").UsedRange.AutoFilter field:=10, Criteria1:=Item
            Sheets.Add(Before:=Sheets(1)).Name = Item
            Sheets("Data").Select
            Range("A1" & ":" & "Y" & erow).SpecialCells(xlCellTypeVisible).Copy
            Sheets(Item).Range("A1" & ":" & "Y1").PasteSpecial Paste:=xlPasteAll
            Application.CutCopyMode = False
            
            x = x + 1
            Next Item
    Next i
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

It's a challenge for some mind readers forum without the entire procedure neither an attachment !​
And maybe it's not an endless loop as Excel may be slow so it just needs some time​
in particular when using a dictionary, filtering, copying instead of a quick & easy advanced filter …​
 
Upvote 0
Can you upload your complete code?
Also don't use names which could conflict with the vba library. Change "Item" to "It" for example
 
Upvote 0
I doubt it's an endless loop, it just seems like it as you dictionary is populated from the Items array, so just get rid of the For i= loop.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,846
Messages
6,121,905
Members
449,054
Latest member
luca142

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top