View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default If 80 in column A and date = today...

try this; it worked for me.
'-----------------------------------------
Sub souriane()

Dim c As Range
Dim myRange As Range
Dim myLastRow As Long
Dim myWS As Worksheet

Set myWS = ActiveWorkbook.Worksheets("Sheet1")
myLastRow = myWS.Cells(10000, 1).End(xlUp).Row
Set myRange = myWS.Range("a1:a" & myLastRow)

For Each c In myRange
If c.Value = 80 Then
If c.Offset(0, 4).Value = Date Then
c.Offset(0, 1).Value = 0
c.Value = 0
With Range("a" & c.Row & ":f" & c.Row).Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
End If
End If
Next c

End Sub
'-------------------------------------------
:)
susan



On Nov 12, 9:45*am, Souriane wrote:
Hello,

I have a table with 200 to 500 entries, where 1 entries = 1 row.

I want a macro that will check for the number “80” *in “column A”. *If
not “80” then nothing.

If 80 in column “A” then for this row:

Check the information in column “E” : if empty or contains a date
later than today then nothing.

If column “E” contains a date earlier or equal to today then:
1. * * *change the 80 for a “0” in column “A”
2. * * *change whatever is in column “B” for also a “0”
3. * * *change the color of the row (from column A to F) in pale blue.

Then that’s it.

Can anyone help me?

Thank you!

Souriane