![]() |
|
#4
|
|||
|
|||
|
Code:
Sub ReadCellContent()
Dim ColHeader As Range
Set ColHeader = Range("A1", Range("A1").End(xlToRight))
Dim ColData As Range
For Each ColData In ColHeader
If ColData.Offset(1, 0) = "" Then
ColData.Interior.Color = vbYellow
End If
If ColData.Offset(1, 0) <> "" Then
Dim ColRange As Range
Dim lData As Range
Set lData = Cells(Rows.Count, ColData.Column).End(xlUp) '.Row
Set ColRange = Range(ColData.Offset(1, 0), lData)
x = ColRange.Rows.Count
y = WorksheetFunction.CountIf(ColRange, ColData.Offset(1, 0))
If x = y Then
ColData.Interior.Color = vbGreen
Else
ColData.Interior.Color = vbRed
End If
End If
Next ColData
End Sub
|
| Tags |
| data compare, macos |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to read text file and organize data in excel
|
srinidhi.mv88 | Excel Programming | 5 | 05-19-2015 12:06 AM |
Macro will not read the value of cell with a formula in it!
|
grayson1231 | Excel Programming | 10 | 03-28-2015 03:47 PM |
| compare, match and count cell contents between sheets | bobsone1 | Excel | 11 | 08-07-2014 10:34 PM |
| Can anyone here tweek this macro for renaming Excel files based on a cell's contents? | chrisd2000 | Excel Programming | 6 | 07-01-2014 01:53 PM |
| Copy all comments & cell contents (i.e. data) to word? | IanM | Excel | 0 | 07-03-2010 11:14 PM |