Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I would like to compare a columns that contains date (2005/11/30)
to today's date. If it is, than increase a cell by one. I'm having problem with the format Private Sub Worksheet_Change(ByVal Target As Range) If Not Application.Intersect(Target, Columns("A1:A10")) Is Null Then ;so it skips the empty cells Application.EnableEvents = False if the cell is today's date than ;not sure of the format Range("A1").Value = Range("A1").Value + 1 Application.EnableEvents = True End If End Sub Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "magickarle" escribió en el mensaje oups.com... Hi, I would like to compare a columns that contains date (2005/11/30) to today's date. If it is, than increase a cell by one. I'm having problem with the format Private Sub Worksheet_Change(ByVal Target As Range) If Not Application.Intersect(Target, Columns("A1:A10")) Is Null Then ;so it skips the empty cells Application.EnableEvents = False if the cell is today's date than ;not sure of the format Range("A1").Value = Range("A1").Value + 1 Application.EnableEvents = True End If End Sub Thanks Try this: If [D1] = Date Then supossing D1 contains the date to compare... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ok but how can I loop the
If D1 = Date then... I would like to do a loop between A1 n A10 Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For column = 1 to 10
if Range ("A" & column).Value = Date Then 'Your actions here End If Next Column Or if you want to compare from A1 to F1 For letter= 65 to 70 'Ascii values of letters A to F if Range (chr(letter) & "1").Value = Date Then 'Your actions here End If Next letter "magickarle" escribió en el mensaje oups.com... Ok but how can I loop the If D1 = Date then... I would like to do a loop between A1 n A10 Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do not say Is "1"
Say = "1" or =1 (depends on if your are handling text or numbers "magickarle" escribió en el mensaje oups.com... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If cell is blank automatically enter today's date in the same cell | Excel Discussion (Misc queries) | |||
conditional formatting for cell date to equal today's date | Excel Worksheet Functions | |||
date in Cell to change colors if the date is beyond today's date | Excel Discussion (Misc queries) | |||
Referencing Cell Next To Today's Date Cell | Excel Discussion (Misc queries) | |||
text and today's date in 1 cell | Excel Discussion (Misc queries) |