Copy row only if one cell's value is not 0
Solved/Closed
victhor1977
Posts
1
Registration date
Thursday 14 April 2016
Status
Member
Last seen
14 April 2016
-
14 Apr 2016 à 10:34
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 18 Apr 2016 à 03:13
vcoolio Posts 1411 Registration date Thursday 24 July 2014 Status Contributor Last seen 6 September 2024 - 18 Apr 2016 à 03:13
Related:
- Copy row only if one cell's value is not 0
- Gacha nebula 1.1 .0 apk download - Download - Casual
- Saints row 2 cheats - Guide
- Need for speed most wanted 5-1-0 - Download - Racing
- How to delete a row in word - Guide
- Summertimesaga-0-20-16-pc - Download - Adult games
2 responses
vcoolio
Posts
1411
Registration date
Thursday 24 July 2014
Status
Contributor
Last seen
6 September 2024
262
16 Apr 2016 à 03:37
16 Apr 2016 à 03:37
Hello Victhor1977,
The following code may do the task for you:-
Any rows of data that do not have a blank cell in Column A or a zero value in Column A will be transferred to sheet2 using the above code. The code will also delete the same rows from sheet1 once they have been transferred to sheet2.
Following is the link to my test work book for you to peruse:-
https://www.dropbox.com/s/fnu8hekouhfsc1h/Victhor1977%28Copy%20on%202%20criteria%20using%20autofilter%29.xlsm?dl=0
Click on the Transfer button to see the code at work. My test work book has nine columns (A - I). Change the references in the code to suit your actual work book including the column number (shown as 9 in the above code: I=9, J=10 etc.).
Test the code in a copy of your work book first.
I hope that this helps.
Cheerio,
vcoolio.
The following code may do the task for you:-
Sub CopyStuff()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row).AutoFilter 1, "<>" & "", xlAnd, "<>" & 0#
Range("A2:I" & Cells(Rows.Count, 9).End(xlUp).Row).Copy Sheet2.Range("A" & Rows.Count).End(3)(2)
Range("A2:I" & Cells(Rows.Count, 9).End(xlUp).Row).Delete
[A1].AutoFilter
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Sheet2.Select
End Sub
Any rows of data that do not have a blank cell in Column A or a zero value in Column A will be transferred to sheet2 using the above code. The code will also delete the same rows from sheet1 once they have been transferred to sheet2.
Following is the link to my test work book for you to peruse:-
https://www.dropbox.com/s/fnu8hekouhfsc1h/Victhor1977%28Copy%20on%202%20criteria%20using%20autofilter%29.xlsm?dl=0
Click on the Transfer button to see the code at work. My test work book has nine columns (A - I). Change the references in the code to suit your actual work book including the column number (shown as 9 in the above code: I=9, J=10 etc.).
Test the code in a copy of your work book first.
I hope that this helps.
Cheerio,
vcoolio.
vcoolio
Posts
1411
Registration date
Thursday 24 July 2014
Status
Contributor
Last seen
6 September 2024
262
18 Apr 2016 à 03:13
18 Apr 2016 à 03:13
Hello Victhor,
Excellent! I'm glad that I was able to help.
Cheerio,
vcoolio.
Excellent! I'm glad that I was able to help.
Cheerio,
vcoolio.
18 Apr 2016 à 02:24
Worked like a charm!