Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default VBA to copy values IF

How can I create a statement that will select all rows on sheet 1 that have
Value "X" (text) in Column B and then paste into Sheet 2, A2?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default VBA to copy values IF

Try this
http://www.rondebruin.nl/copy5.htm

Below the first macro you can read how to do it manual

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Memphus01" wrote in message ...
How can I create a statement that will select all rows on sheet 1 that have
Value "X" (text) in Column B and then paste into Sheet 2, A2?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default VBA to copy values IF

Ron - thanks for your help --

it runs perfectly---but when I tried to step out on my own a bit and create
up to 8 criteria I am messing up somewhere---

in the line--

rng.AutoFilter Field:=1, Criteria1:="=Netherlands", Operator:=xlOr,
Criteria2:="=USA"

how would I add a third crtieria, etc? I tried the following:

rng.AutoFilter Field:=1, Criteria1:="=Netherlands", Operator:=xlOr,
Criteria2:="=USA", Operator:=xlOr, Criteria3:="=FRANCE" , Operator:=xlOr,
Criteria4:="=Germany"

but keep getting an error on the third Criteria---

Thanks

"Ron de Bruin" wrote:

Try this
http://www.rondebruin.nl/copy5.htm

Below the first macro you can read how to do it manual

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Memphus01" wrote in message ...
How can I create a statement that will select all rows on sheet 1 that have
Value "X" (text) in Column B and then paste into Sheet 2, A2?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default VBA to copy values IF

There is a Max of 2 when you use AutoFilter
You can use Advanced filter or use a helper column with

=OR(A2={"USA","USA2","USA3","USA4","USA5"})

Then use AutoFilter on that column

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Memphus01" wrote in message ...
Ron - thanks for your help --

it runs perfectly---but when I tried to step out on my own a bit and create
up to 8 criteria I am messing up somewhere---

in the line--

rng.AutoFilter Field:=1, Criteria1:="=Netherlands", Operator:=xlOr,
Criteria2:="=USA"

how would I add a third crtieria, etc? I tried the following:

rng.AutoFilter Field:=1, Criteria1:="=Netherlands", Operator:=xlOr,
Criteria2:="=USA", Operator:=xlOr, Criteria3:="=FRANCE" , Operator:=xlOr,
Criteria4:="=Germany"

but keep getting an error on the third Criteria---

Thanks

"Ron de Bruin" wrote:

Try this
http://www.rondebruin.nl/copy5.htm

Below the first macro you can read how to do it manual

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Memphus01" wrote in message ...
How can I create a statement that will select all rows on sheet 1 that have
Value "X" (text) in Column B and then paste into Sheet 2, A2?


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 Values with VBA Ed Excel Discussion (Misc queries) 2 October 21st 06 05:48 PM
copy between worksheets does not copy formulae just values Chris@1000 Oaks Excel Discussion (Misc queries) 0 March 19th 06 11:44 AM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
copy values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
copy values generated by conditional formula in one sheet to the other work sheet as values bobby Excel Discussion (Misc queries) 1 October 5th 05 12:18 PM


All times are GMT +1. The time now is 06:40 AM.

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

About Us

"It's about Microsoft Excel"