Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Copy row on criteria

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")

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy row on criteria

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"miek" wrote in message
...
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")


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Copy row on criteria

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?


"Don Guillett" wrote:

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"miek" wrote in message
...
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")



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Copy row on criteria

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")

"miek" wrote:

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")

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Copy row on criteria

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?



"Joel" wrote:

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")

"miek" wrote:

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")



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy is criteria met Kitten74 Excel Worksheet Functions 3 April 29th 10 05:35 PM
Copy is criteria met Don Guillett[_2_] Excel Worksheet Functions 2 April 29th 10 05:09 PM
Copy is criteria met Don Guillett[_2_] Excel Worksheet Functions 0 April 29th 10 04:20 PM
Copy with criteria acw[_2_] Excel Programming 0 February 6th 04 12:06 AM
Copy with criteria James Stephens Excel Programming 5 November 11th 03 10:51 PM


All times are GMT +1. The time now is 08:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"