LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Copy with criteria

Juliann

The following will copy from sheet1 to sheet2. I've got data in rows 2:5 and the sum in row 4 is 0. Rows 2,3 and 5 copy, while row 4 does not. You don't specify how you want the output to look, so I've just copied it to the same relative place on sheet2

HT
Ton
Sub aaa(
Sheets("sheet1").Selec
Range("D2").Selec
While Not IsEmpty(ActiveCell
If WorksheetFunction.Sum(Range(ActiveCell.Address), Range(ActiveCell.Offset(0, 4).Address)) 0 The
Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy Destination:=Sheets("sheet2").Cells(ActiveCell.Row , 4
End I
ActiveCell.Offset(1, 0).Selec
Wen

End Su

----- Julianna wrote: ----

I need to copy several lines from 'sheet 1' to sheet 2' that from column D to H that the sum(D:H) is greater than zero

I know this can be done thru filters but the file users of this spreadsheet have very limited Excel knowledge (less than I have :), so I am trying to do it thru VBA

Thanks in advance

Julianna
 
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
under certain criteria copy data. dave Excel Worksheet Functions 2 November 16th 04 02:56 AM
Copy with criteria James Stephens Excel Programming 5 November 11th 03 10:51 PM


All times are GMT +1. The time now is 11:24 AM.

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"