Vba sorting different from 0

aurore -  
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   -
Bonjour,

I use the following macro which works wonderfully when at least one of my filtered data is different from "0:00".
My problem occurs when all my data is equal to "0:00" because in this case, at the time of my copy-paste to my second spreadsheet, all my data from the first sheet gets selected and pasted while I don’t want any.

Where should I modify my macro to ensure that no data is pasted if all my values are equal to "0:00"?

Thank you for your responses

Aurore

Here is the famous macro!

`Sort in the first tab values different from "0:00"

Sheets("BASE DONNEES_SV").Select
Selection.AutoFilter Field:=24, Criteria1:="<>0:00", Operator:=xlAnd 'criteria different from 0:00 Range("A5:E350").Select
Selection.Copy

'Second sheet where I copy my filtered data

Sheets("ORDO_SV").Select
Range("A6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

`Remove filter

Sheets("BASE DONNEES_SV").Select
Selection.AutoFilter Field:=24
Sheets("ORDO_SV").Select

4 answers

michel_m Posted messages 18903 Registration date   Status Contributor Last intervention   3 320
 
Hello

are your Zeros (or "" or empty ?) in column X (24) entries or formulas?
--
:-x
0
aurore
 
Yes, it is a cell that results from the multiplication of two others located a few columns earlier.
0
michel_m Posted messages 18903 Registration date   Status Contributor Last intervention   3 320
 
I'm sorry, I've just returned
but you might find an answer on this essential site in the "filters" section
http://boisgontierjacques.free.fr/
0
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
 
Hello,

A suggestion: sum your column and filter-paste only if <> 0

Eric
0