I'm fairly new to VBA and I've been struggling over this problem for a couple weeks.
Every time a name has passed a training, the corresponding name/training title cell is filled with the date, and the background is filled in yellow RGB(255,255,0). When IN training they are filled with a yellow background and no date. (There are also some that are red or grey for out of date, but I think I have already worked those out.)
The end goal is to have a separate output sheet within the same file. This sheet will only contain the necessary Training Titles at the top, and all of the names under it if they are the blank yellow cells (No date + yellow). Eventually I would like to be able to email this list to certain people, but I think there are enough resources to figure that out myself.
Currently, I have code to find the max/min of the column/rows, and code that deletes all cells containing dates. My plan was to have it scan the remaining cells for any that were yellow, then paste the training titles/names on a new sheet, but I cannot figure out how to that in VBA.
I'm sure there has to be an easier way to do this as it is several hundred columns wide and rows long.
Thanks for any input!
EDIT: This is the code I am currently using. This scans the range of name vs training and clears the cell data if it is any other color than yellow, or if it is yellow with a date.
I attached an image to help explain more clearly. The important cells are the ones that are yellow with no date. From those cells I need to paste the Training Title in Row 1, and the Name of the person in Column A on a new sheet in the way you can see in the picture.
Sub ClearCellMacro()
Dim myLastCell As Range
Dim cell As Range
Application.ScreenUpdating = False
'Find last cell
Set myLastCell = Range("C4").SpecialCells(xlLastCell)
'Make sure last cell is outside of first row and column (or else exit)
If myLastCell.Row = 1 Or myLastCell.Column = 1 Then Exit Sub
'Loop through entire range removing cell contents if value is not numeric
For Each cell In Range("C4:" & myLastCell.Address)
If Not IsNumeric(cell) Then cell.Clear
Next cell
For Each cell In Range("C4:" & myLastCell.Address)
If cell.Interior.Color <> RGB(255, 255, 0) Then cell.Clear
Next cell
Application.ScreenUpdating = True
MsgBox "Non-Yellow + Blank Cells Removed."
End Sub