Can I copy based on formatting?

TotalRapture

New Member
Joined
Jun 30, 2017
Messages
15
Morning everybody!

My knowledge regarding VBA is a little scattered; I can do some very specific things but trying to step outside of those particulars and I generally hit a lot of walls due to my lack of foundational knowledge.

I would like to search a table for cells with specific formatting and then copy those cells to another row. I'm kind of starting from scratch; I have been playing with different formula/code for the passed day or so but have not made much headway.

I found this function to at least count the highlighted cells online:

Function CountColor(rRange As range, specify As range) As Long
Dim data As range
Dim color As Long
color = specify.Interior.ColorIndex
For Each data In rRange
If data.Interior.ColorIndex = color Then
CountColor = CountColor + 1
End If
Next data
End Function

And it was working on my test sheet but I could not replicate it on the actual data. I believe this could be due to the data being highlighted using Conditional Formatting. I think if I could get this working on the data sheet I could rewrite/add to it in a way that it will take the highlighted cell contents and paste it somewhere else (end goal), but, admittedly, there's a good chance I'll need some help with that as well.

If anyone could help me out with getting it to pick up the conditionally formatted cells I could start playing with the next level and I would be hella appreciative. Thanks for your time!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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