Too many line continuations

JTL9161

Active Member
Joined
Aug 29, 2012
Messages
345
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
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
7,002
Office Version
  1. 365
  2. 2016
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?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows
James

Filtering on 2 criteria should only take a couple of lines of code.
 

JTL9161

Active Member
Joined
Aug 29, 2012
Messages
345
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

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.
 

dave3009

Well-known Member
Joined
Jun 23, 2006
Messages
7,002
Office Version
  1. 365
  2. 2016
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*"
 

JTL9161

Active Member
Joined
Aug 29, 2012
Messages
345

ADVERTISEMENT

Thanks. I was entering IL in the SEARCH field. I will give it a try.
 

JTL9161

Active Member
Joined
Aug 29, 2012
Messages
345
How can I make Range("$A$1:$W$4059") variable? Row is W will vary each day. :$W" did not work.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,230
Office Version
  1. 365
Platform
  1. Windows
Do you mean the no of rows could change?
 

Watch MrExcel Video

Forum statistics

Threads
1,123,323
Messages
5,600,954
Members
414,417
Latest member
Nobu

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
Top