How can I automatically copy table to next sheet?

Solved/Closed
DanielOfir15 - Mar 27, 2018 at 06:02 PM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - Mar 28, 2018 at 12:42 AM
Hello,

I have an Excel file with 30 sheets containing the same table. In the table, the last column is a Yes/No (using data validation).
Once a day, I need to manually copy all the "No" rows to the next sheet.
According to what I saw on google, I need a macro to copy a range of cells to the next sheet - but only for the lines that present "No" in the last cell of the row.
I'll try to present it better below.
(No is the answer to the "reverted" cell)

Engineer | Action | Date of Action| Time of Action | Reverted
X | X | X| X | No
X | X | X| X | No
X | X | X| X | Yes
X | X | X| X | Yes
X | X | X| X | No

Basically I need to automatically copy all the rows that end with "No" to the next sheet.
Hope my request is understandable enough :)

Thanks ahead everyone..
Daniel





7 responses

vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 27, 2018 at 10:34 PM
Hello Daniel,

Could you please clarify your opening post a little more.

By "next sheet" do you mean a summary sheet?
Do you need all rows with "No" in Column E from each sheet to be transferred to a summary sheet?

Cheerio,
vcoolio.
0
Hey, thanks for the response!

It's a worksheet with 31 sheets on it, I'm filling new information every day. So I'm copying all the information with "No" in column L (lines 32-65) to the next sheet (next day).
All the 31 sheets are empty (until we get to the day), and at the end of the day, all the rows that answer "No" needs to be copied to the next day. (All the sheets name's are numbers between 1-31).
The information should be filled in lines 31-65, based on the first empty line.

Let me know if you need more information..
Thanks!
0
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 27, 2018 at 11:07 PM
Hi Daniel,

So you have headings in row 31 of each sheet" with data starting in row 32?

Cheerio,
vcoolio.
0
Yep, the table's first row is 31 containing the "headlines", and the data is starting in row 32 to 65.
0
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 27, 2018 at 11:31 PM
Hi Daniel,

Try the following code assigned to a button (on each sheet):-

Sub CopyData()

Application.ScreenUpdating = False

With ActiveSheet.[A31].CurrentRegion
                .AutoFilter 12, "No"
                .Offset(1).Copy
                ActiveSheet.Next.Range("A" & Rows.Count).End(3)(2).PasteSpecial xlValues
                .AutoFilter
End With

Application.ScreenUpdating = True
Application.CutCopyMode = False
ActiveSheet.Next.Select

End Sub


It will operate from the active sheet (on whichever day) and transfer all relevant rows of data with a "No" in Column L to the next sheet.

I hope that this helps.

Cheerio,
vcoolio.
0
Thanks very much for the help!
It does copy the rows to the next sheet, but to other lines - I need it to move to line 32 and forward.
Also, is there a way to apply it for the whole sheet and it will update automatically once a change is made? or do I have to apply it each time I want to copy the info?
0
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 27, 2018 at 11:53 PM
Hi Daniel,

Other lines?

In which column does the data start in?

Cheerio,
vcoolio.
0
The data is showing up in the next sheet starting line 16 column B.
The data starts in column B, so that would make B32 as the first data cell.
0

Didn't find the answer you are looking for?

Ask a question
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 28, 2018 at 12:01 AM
Ok. Change line 8 in the code to:-

ActiveSheet.Next.Range("B" & Rows.Count).End(3)(2).PasteSpecial xlValues


Cheerio,
vcoolio.
0
Now it's starting from line 32 (correctly) but from column C lol
0
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 28, 2018 at 12:10 AM
Sorry Daniel,

Another couple of changes are necessary with the last change.

Change line 5 to:-

With ActiveSheet.[B31].CurrentRegion


and line 6 to:-
.AutoFilter 11, "No"


Cheerio,
vcoolio.
0
Now it works great, thank you very much! :)
0
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 262
Mar 28, 2018 at 12:42 AM
You're welcome Daniel.

I'm glad that I was able to help.

Cheerio,
vcoolio.
0