Highlighting cells being updated/new data being inputted.

  • Thread starter Faraz A. Qureshi
  • Start date
F

Faraz A. Qureshi

I have to update a sheet every week. Any idea, how to have a column be
highlighted and every cell be un-colored when updated with the new values
inserted, even if the new values of a cell remain to be the same.
 
J

Jacob Skaria

Hi Faraz

I assume the sheet is having a header row (Row 1) with the week
number/date..The below Activate event will check for filled cells. If no
cells are filled except Row1 the column is highlighted.

Once you fill data the cell highligtion is taken off. Not sure whether this
is what you are looking for.

Private Sub Worksheet_Activate()
Dim lngCol As Long, lngLastCol As Long
lngLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
For lngCol = 2 To lngLastCol
Columns(lngCol).Interior.ColorIndex = xlColorIndexNone

'If highligtion is based on number of cells filled in that column
If WorksheetFunction.CountA(Columns(lngCol)) <= 1 _
Then Columns(lngCol).Interior.ColorIndex = 15

'OR

'if the 1st row is having dates Highligtion based on dates
If Cells(1,lngCol)>Date then Columns(lngCol).Interior.ColorIndex = 15

Next
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 Then Target.Interior.ColorIndex = xlColorIndexNone
End Sub

If this post helps click Yes
 
F

Faraz A. Qureshi

XClent idea!

Never had the idea of using Interior.ColorIndex concept!!!

Thanx pal!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top