Copy coloured cells to another spreadsheet

ELEANOR1690

New Member
Joined
Sep 5, 2018
Messages
11
[TABLE="width: 571"]
<tbody>[TR]
[TD]ROUTINE MAINTENANCE[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Bus No[/TD]
[TD]Job No[/TD]
[TD="colspan: 3"]Type[/TD]
[TD]ins[/TD]
[TD]VOR[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]NE[/TD]
[TD]TYRE REPAIR[/TD]
[TD][/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="colspan: 3"][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

If the above range as no background colour I would like it to be copied to the next sheet.

Sheets are in date range IE sheet 1 is named 16-SEP-2018 sheet 2 17-SEP-2018 sheet 3 18-SEP-2018 ETC

The idea is that any cells not highlighted in the range have to be copied to the next days worksheet

Can anyone help
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hello Eleanor,

The link doesn't work. Please use a free file sharing site (e.g. Drop Box).

Thank you,
vcoolio.
 
Upvote 0
Hello Eleanor,

It seems as if we are dealing solely with the range A8:G18.

I noticed a couple of things in your workbook that haven't helped our cause:

1) You have placed the code in the worksheet module. This code is not an event code and needs to be placed in a standard module and assigned to a button.
2) Each sheet has merged cells in the area we are dealing with, viz. Range A8:G18. Merged cells create havoc with VBA codes and need to be avoided.

Following is the revised code which also "unmerges" the merged cells in the range we are dealing with. You will still be able to successfully format the cells without merging any of them.


Code:
Sub CopyData()

Dim sh As Worksheet: Set sh = ActiveSheet

Application.ScreenUpdating = False

With sh.Range("A7:G18")
        [COLOR=#ff0000].UnMerge
        sh.Next.Range("A8:G18").UnMerge[/COLOR]
        .AutoFilter 1, , 12
        .Columns("A:G").Offset(1).Copy
        sh.Next.Range("A18").End(3)(2).PasteSpecial xlValues
        .AutoFilter
End With

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

End Sub

Following is the link to your file with the code implemented. I have created a "NEXT" button on three of the date sheets so that you can see how it works. On clicking on the button, the code will transfer each row of data that is NOT high-lighted (based on Column A) to the next sheet.

http://ge.tt/8c3K3cr2

I hope that this helps.

Cheerio,
vcoolio.
 
Upvote 0
Thank you so much for this it has been a fantastic help unfortunately the link takes me to the site but says there are no share files :)
 
Upvote 0
Hello Eleanor,

Try it again here:-

http://ge.tt/52QoUcr2

I can create the button but cannot seem to attach the code

Right click on the shape and select "Assign Macro". From the "Assign Macro" pop-up, select CopyData (the name of the macro). Click OK.

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top