How to use multiple coloured cells in rows as references?

Ed Harris

New Member
Joined
Dec 9, 2017
Messages
49
Office Version
  1. 2010
Platform
  1. Windows
Hello
For this data can anyone tell me how to collect the data in columns P to T for any row where there is a yellow cell or blue cell into new columns so that I can plot them? the problem that I see is that there are duplicates and both types in the same row and I don't know how to add output data onto the bottom of a column. Also for each coloured cell it would be very useful to get the cell address. I have done a few searches trying to work out how to do this but they mostly come up with the same thing - not quite what I need.
Any help much appreciated.

test data 2021.xlsx
ABCDEFGHIJKLMNOPQRST
1DateTempw speed
274.5787474.5787174.5787174.578874.5787774.5787874.5788574.5788574.5788974.5788974.5788674.5788574.5788974.578974.5789216/03/2021 07:31142.901
374.5777374.5776474.5777974.5777774.5777574.5777574.5778174.5777574.5777874.5777774.5778474.5778174.5779374.5779774.5779616/03/2021 07:3514.25.810
474.5779374.5779674.5780774.5780574.5778774.577974.5779274.5779174.57874.5781374.5779774.5780174.57874.5780474.5780916/03/2021 07:3914.23.201
574.5795474.5795574.5793774.5795274.5794574.5795874.5795174.579474.5795274.5795274.5794374.5795274.5793574.5794774.5793816/03/2021 07:4414.21.910
674.5801874.5801874.5802474.5802674.5801974.5801974.5802274.5802474.5801974.5802274.5802174.5802874.5802674.5803674.5802316/03/2021 07:4814.32.301
774.5789574.5789674.5790174.5790174.5790574.5791974.5790774.5790774.5790774.5791274.5790674.5790474.5790974.5790974.5790316/03/2021 07:5314.33.910
Sheet1
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Excel is not built for considering color a data. It's a visual highlight for human use only.
You might try this code
VBA Code:
Sub Test()
    Dim oneCell As Range
    Dim SourceRange As Range
    Dim DestinationRange As Range
    
    Set SourceRange = Sheet1.Range("A1"): Rem adjust
    Set DestinationRange = Sheet2.Range("a1"): Rem adjust
    
    For Each oneCell In SourceRange.CurrentRegion
        If oneCell.DisplayFormat.Interior.Color <> vbWhite Then
            With DestinationRange.EntireColumn.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
                oneCell.Copy Destination:=.Cells(1, 1)
                .Cells(1, 1).Value = oneCell.Value
                .Cells(1, 2).Value = oneCell.Address(, , , True)
            
            End With
        End If
    Next oneCell
End Sub
 
Upvote 0
Excel is not built for considering color a data. It's a visual highlight for human use only.
You might try this code
VBA Code:
Sub Test()
    Dim oneCell As Range
    Dim SourceRange As Range
    Dim DestinationRange As Range
  
    Set SourceRange = Sheet1.Range("A1"): Rem adjust
    Set DestinationRange = Sheet2.Range("a1"): Rem adjust
  
    For Each oneCell In SourceRange.CurrentRegion
        If oneCell.DisplayFormat.Interior.Color <> vbWhite Then
            With DestinationRange.EntireColumn.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
                oneCell.Copy Destination:=.Cells(1, 1)
                .Cells(1, 1).Value = oneCell.Value
                .Cells(1, 2).Value = oneCell.Address(, , , True)
          
            End With
        End If
    Next oneCell
End Sub
Thats great, thanks for the effort. Unfortunately it stopped at destination range with the error "object required" so I tried changing it to:
Set DestinationRange = Sheet1.Range("BK1"): Rem adjust
with the result that nothing changed when I ran the macro.
By the way Is there a better way to label cells, for referencing, other than colour as I am having to do that manually due to the amount of judgment required to categorise them?
 
Upvote 0
What you might do is have a double click to both color them and move them to the other sheet. But that would pretty much restrict you to one color.
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,727
Members
449,049
Latest member
MiguekHeka

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