I have a macro which is filtering a sheet based on a number of criteria specified by a user via drop downs. The code was working fine until I just added a small amount of code today, and now it says "Procedure too Large" and highlights "End Sub" in my code. Here is a portion of my old code:
My code is basically just this repeated 15 more times, with a slightly different elseif statement at the beginning of the code. This is what I added right before the FilteredDataRow = FilteredDataRow + 1 line:
I also added:
at the beginning of the code and set it back to true at the end of my code.
Does anyone have any clue why it is telling me that the procedure is too large????
Any help would be greatly appreciated.
Thanks!
Hank
Code:
If Period1 = "All Periods" And Period2 = "All Periods" And DurObs = "All Durations of Observation" And DurPos = "All Durations in Position" Then
For RowNums = 2 To DataRangeNum
With Sheets("Data_Import_Infopath")
If .Range("AE" & RowNums).Value <> "TEST PATTERN" And .Range("AA" & RowNums).Value = 1 Then
Sheets("Filtered_Data").Range("A" & FilteredDataRow).Value = .Range("AE" & RowNums).Value & " " & .Range("AC" & RowNums).Value & " " & .Range("AB" & RowNums).Value
Sheets("Filtered_Data").Range("B" & FilteredDataRow).Value = .Range("AS" & RowNums).Value
Sheets("Filtered_Data").Range("C" & FilteredDataRow).Value = .Range("AU" & RowNums).Value
Sheets("Filtered_Data").Range("D" & FilteredDataRow).Value = .Range("AW" & RowNums).Value
Sheets("Filtered_Data").Range("E" & FilteredDataRow).Value = .Range("AY" & RowNums).Value
Sheets("Filtered_Data").Range("F" & FilteredDataRow).Value = .Range("BA" & RowNums).Value
Sheets("Filtered_Data").Range("G" & FilteredDataRow).Value = .Range("BC" & RowNums).Value
Sheets("Filtered_Data").Range("H" & FilteredDataRow).Value = .Range("BE" & RowNums).Value
Sheets("Filtered_Data").Range("I" & FilteredDataRow).Value = .Range("BG" & RowNums).Value
Sheets("Filtered_Data").Range("J" & FilteredDataRow).Value = .Range("BI" & RowNums).Value
Sheets("Filtered_Data").Range("K" & FilteredDataRow).Value = .Range("BK" & RowNums).Value
Sheets("Filtered_Data").Range("L" & FilteredDataRow).Value = .Range("BM" & RowNums).Value
Sheets("Filtered_Data").Range("M" & FilteredDataRow).Value = .Range("BO" & RowNums).Value
Sheets("Filtered_Data").Range("P" & FilteredDataRow).Value = .Range("AE" & RowNums).Value & " " & .Range("AC" & RowNums).Value & " " & .Range("AB" & RowNums).Value
Sheets("Filtered_Data").Range("Q" & FilteredDataRow).Value = .Range("AR" & RowNums).Value
Sheets("Filtered_Data").Range("R" & FilteredDataRow).Value = .Range("AT" & RowNums).Value
Sheets("Filtered_Data").Range("S" & FilteredDataRow).Value = .Range("AV" & RowNums).Value
Sheets("Filtered_Data").Range("T" & FilteredDataRow).Value = .Range("AX" & RowNums).Value
Sheets("Filtered_Data").Range("U" & FilteredDataRow).Value = .Range("AZ" & RowNums).Value
Sheets("Filtered_Data").Range("V" & FilteredDataRow).Value = .Range("BB" & RowNums).Value
Sheets("Filtered_Data").Range("W" & FilteredDataRow).Value = .Range("BD" & RowNums).Value
Sheets("Filtered_Data").Range("X" & FilteredDataRow).Value = .Range("BF" & RowNums).Value
Sheets("Filtered_Data").Range("Y" & FilteredDataRow).Value = .Range("BH" & RowNums).Value
Sheets("Filtered_Data").Range("Z" & FilteredDataRow).Value = .Range("BJ" & RowNums).Value
Sheets("Filtered_Data").Range("AA" & FilteredDataRow).Value = .Range("BL" & RowNums).Value
Sheets("Filtered_Data").Range("AB" & FilteredDataRow).Value = .Range("BN" & RowNums).Value
FilteredDataRow = FilteredDataRow + 1
End If
End With
Next RowNums
My code is basically just this repeated 15 more times, with a slightly different elseif statement at the beginning of the code. This is what I added right before the FilteredDataRow = FilteredDataRow + 1 line:
Code:
Sheets("Filtered_Data").Range("AD" & FilteredDataRow).Value = .Range("AE" & RowNums).Value
Sheets("Filtered_Data").Range("AE" & FilteredDataRow).Value = .Range("AC" & RowNums).Value & " " & .Range("AB" & RowNums).Value
I also added:
Code:
Application.ScreenUpdating = False
at the beginning of the code and set it back to true at the end of my code.
Does anyone have any clue why it is telling me that the procedure is too large????
Any help would be greatly appreciated.
Thanks!
Hank