Too many line continuations

JTL9161

Well-known Member
Joined
Aug 29, 2012
Messages
567
Office Version
  1. 365
Platform
  1. Windows
I recorded a macro to filter the state indicator "IL" in a worksheet (4000 rows) (Column J). I need to then filter another column (N) within the "IL" for "HMO" When I tried recording the macro I got 400 "IL" rows and the macro stopped recording and the error message was "Too many line continuations"

This amount of 'IL" will vary from day to day. What can I use for the filter (IL) then filter (HMO) option in my macro?

Any help will be appreciated.
James
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
The too may line continuations error will occur when the recorder has recorded something that is too long for one action.

What is the code it created for you?
 
Upvote 0
James

Filtering on 2 criteria should only take a couple of lines of code.
 
Upvote 0
This is what it gave me. I guess you can't record for something like this.

Range("J1").Select
ActiveCell.FormulaR1C1 = "State"
Range("J1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$W$4059").AutoFilter Field := 10, Criteria1 := Array( _
"0IL0100CG2WV","0IL0100CG34S","0IL0100CG52G","0IL0100CG52P","0IL0100CG532", _
"0IL0100CG535","0IL0100CG538","0IL0100CG53Q","0IL0100CG542","0IL0100CG546", _
"0IL0100CG547","0IL0100CG54C","0IL0100CG54D","0IL0100CG54J","0IL0100CG554", _
"0IL0100CG555","0IL0100CG556","0IL0100CG557","0IL0100CG559","0IL0100CG55W", _
"0IL0100CG563","0IL0100CG567","0IL0100CG568","0IL0100CG578","0IL0100CG57X", _
"0IL0100CG587","0IL0100CG7AA","0IL0100CG7AD","0IL0100CG7AU","0IL0100CG7N1", _
"0IL0100CG7P5","0IL0100CG7P8","0IL0100CG7Q9","0IL0100CG7R1","0IL0100CG7SX", _
"0IL0100CGAA9W","0IL0100CGABJ1","0IL0100CGABJ3","0IL0100CGABJ5","0IL0100CGABJY" _
,"0IL0100CGABJZ","0IL0100CGACH5","0IL0100CGACH7","0IL0100CGACHJ", _
"0IL0100CGADEC","0IL0100CGADH3","0IL0100CGADIU","0IL0100CGADJ8","0IL0100CGADK1" _
,"0IL0100CGADK3","0IL0100CGADK4","0IL0100CGADK5","0IL0100CGADKS", _
"0IL0100CGADLK","0IL0100CGADLM","0IL0100CGADLQ","0IL0100CGADMA","0IL0100CGAG9L" _
,"0IL0100CGB3Q","0IL0100CGC75","0IL0100CGC7X","0IL0100CGDAP","0IL0100CGDOM", _
"0IL0100CGDOV","0IL0100CGDOZ","0IL0100CGDZS","0IL0100CGDZV","0IL0100CGEDZ", _
"0IL0100CGHDW","0IL0100CGIC1","0IL0100CGIDE","0IL0100CGIDF","0IL0100CGIDI", _
"0IL0100CGITY","0IL0100CGIU3","0IL0100CGIV1","0IL0100CGIVA","0IL0100CGIVJ", _
"0IL0100CGMHJ","0IL0100CGN44","0IL0100CGOXI","0IL0100CGOXZ","0IL0100CGOZF", _
"0IL0100CGP0N","0IL0100CGP0P","0IL0100CGPYO","0IL0100CGPZP","0IL0100CGPZY", _
"0IL0100CGQC6","0IL0100CGQCT","0IL0100CGQE8","0IL0100CGQE9","0IL0100CGQEU", _
"0IL0100CGQEZ","0IL0100CGQF5","0IL0100CGQF6","0IL0100CGQFL","0IL0100CGQFW", _
"0IL0100CGQFZ","0IL0100CGQGM","0IL0100CGQH7","0IL0100CGUST","0IL0100CGVL17", _
"0IL0100CGVL18","0IL0100CGX1B","0IL0100CGX6Z","0IL0100CGX7G","0IL0100CGX7H", _
"0IL0100CGX7J","0IL0100CGY3F","1IL0100CG532","1IL0100CG535","1IL0100CG54X", _
End Sub
 
Upvote 0
What exactly are you filtering for there?

Are you trying to find if the values in column J contain 'IL'?

If you are try recording another macro and choose Custom>Contains... and enter IL.
 
Upvote 0
Yeah, that's be it. It's looking to compile each value of something IL something, which can be shortened to

Code:
Range("J1") = "State"
Range("J1").AutoFilter
ActiveSheet.Range("$A$1:$W$4059").AutoFilter Field:=10, Criteria1:="*IL*"
 
Upvote 0
Thanks. I was entering IL in the SEARCH field. I will give it a try.
 
Upvote 0
How can I make Range("$A$1:$W$4059") variable? Row is W will vary each day. :$W" did not work.
 
Upvote 0
Do you mean the no of rows could change?
 
Upvote 0
yes. I will not always be 4059. It will vary each day.
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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