View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
magickarle magickarle is offline
external usenet poster
 
Posts: 18
Default If a cell value is today's date, than increace cell value by one

cool. I didn't think of using ascii value (I did it when I was doing
Ada script. I guess it's the same principle as other script language)

Another question: I would like to compare two columns
Ex: @ an event on column F do
If column F = 1 and Column G got nothing do
Increase F341 by one
If column F = 2 and Column G got nothing do
Increase F342 by one
If column F = 3 and Column G got nothing do
Increase F343 by one
End if.a
What I did is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Columns("F:F")) Is Nothing Then
Application.EnableEvents = False
If Application.Intersect(Target, Columns("F:F")) Is "1" And
Application.Intersect(Target, Columns("G:G")) Is Nothing Then
Range("F341").Value = Range("F341").Value + 1
If Application.Intersect(Target, Columns("F:F")) Is "2" And
Application.Intersect(Target, Columns("G:G")) Is Nothing Then
Range("F342").Value = Range("F342").Value + 1
If Application.Intersect(Target, Columns("F:F")) Is "3" And
Application.Intersect(Target, Columns("G:G")) Is Nothing Then
Range("F343").Value = Range("F343").Value + 1
End If
End If
End Sub

It gives me an error "type not compatible" for the Is "1" in the first
if.
I guess it's bcause I choose Private Sub Worksheet_Change(ByVal Target
As Range)

thanks again for your help.