Over looping

christchaaya

Board Regular
Joined
Apr 5, 2013
Messages
86
Code:
Sheets("SA").Select
    Range("IV3").End(xlToLeft).Select
    Set x = ActiveCell
    ActiveSheet.ListObjects("Tabla1").Range.AutoFilter Field:=11, Criteria1:=x
    Range("e12").Select
    For i = 1 To 30000
    If InStr(ActiveCell(i, 1).Value, "PERMISO SINDICAL") > 0 Then
        ActiveCell(i, 1).Offset(0, 11) = "x"
        Range("e12").Select
    Else
    End If
    Next i
    Range("e12").Select
    For i = 1 To 30000
    If InStr(ActiveCell(i, 1).Value, "REUNION SOLICITADA POR EMPRESA") > 0 Then
        ActiveCell(i, 1).Offset(0, 12) = "x"
        Range("e12").Select
    Else
    End If
    Next i
    ActiveSheet.ListObjects("Tabla1").Range.AutoFilter Field:=11

Hello guys , the code above works good but i need to make a modification so it will be better.

1) I need to loop it 40000 times but it gives me an error which tolds me that the number of loops is over the limit ( I didn't knew there's a limit of time i can loop , what is it ? )

2) As you can see in the code I filtered the table but it looks inefective because my program is starting from the first row of the tableand not from the first filtered row, how can i make the filter work properly and make the program to start working from the first filtered row ??

Thank you in advance everybody :D:D
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,196,308
Messages
6,014,573
Members
441,828
Latest member
cofracr

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