Vba sorting different from 0
aurore
-
eriiic Posted messages 24581 Registration date Status Contributor Last intervention -
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
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
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/
but you might find an answer on this essential site in the "filters" section
http://boisgontierjacques.free.fr/