Copy row on criteria

M

miek

I want to copy then entire row from WS "raw_copy" to "RC_new" if the
text in column E contains a substring of "Alarms"
I was hoping this code would do it ... compiler error
Do I have a syntax problem or a logic problem THXs

Worksheets("Raw_copy").Range("E1:E" & g_var1).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Worksheets("RC_New").Range( _
"A1"), Unique:=False, CriteriaRange:=Range("Alarms")
 
D

Don Guillett

This is a macro that will look in column a and extract all
unique items to column F. Adapt to suit

Sub makeuniquelist()
Application.ScreenUpdating = False
mc = "a"
lr = Cells(Rows.Count, mc).End(xlUp).Row
With Range("A1:A" & lr)
.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Copy Range("F1")
Application.CutCopyMode = False
ActiveSheet.ShowAllData
End With
Application.ScreenUpdating = True
End Sub
 
J

Joel

You are missing a line continuation (_) at the end of the 1st line

Worksheets("Raw_copy").Range("E1:E" & g_var1).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("RC_New").Range("A1"), _
Unique:=False, _
CriteriaRange:=Range("Alarms")
 
M

miek

The missing continuation char "_" was in my code, I jsut had a copy and paste
problem. I get a runtime 1004 error
Does the worksheet advancedfilter function look for a set text string critera?
 
M

miek

I'm not really looking for only "unique" values, per se.
colE
alarm txt1
alarm txt2
alarm txt3
text1

If colE has the substring of "alarm" I would like to copy/paste to WS "RC_New"
I was thinking the advancedfilter with CriteriaRange:=Range("Alarms")
would get this for me
Is this correct?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top