Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
-Hello Everyone
I have a problem searching for a date. It works when I record it but not when I run the code. Sub FindDate Cells.Find(What:="14/12/2005", After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate End Sub Running the macro above returns 'Object variable or With block variable not set' But if I end the code and do Shift+F4 to 'find again' Excel goes straight to the cell? Thanks for reading this far, and in advance for any help Matt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub FindDate()
Cells.Find(What:=CDate("14/12/2005"), _ After:=ActiveCell, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Matt" wrote in message ... -Hello Everyone I have a problem searching for a date. It works when I record it but not when I run the code. Sub FindDate Cells.Find(What:="14/12/2005", After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate End Sub Running the macro above returns 'Object variable or With block variable not set' But if I end the code and do Shift+F4 to 'find again' Excel goes straight to the cell? Thanks for reading this far, and in advance for any help Matt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's done the trick
Thanks Bob Matt "Bob Phillips" wrote: Sub FindDate() Cells.Find(What:=CDate("14/12/2005"), _ After:=ActiveCell, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlNext, _ MatchCase:=False, _ SearchFormat:=False).Activate End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Matt" wrote in message ... -Hello Everyone I have a problem searching for a date. It works when I record it but not when I run the code. Sub FindDate Cells.Find(What:="14/12/2005", After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate End Sub Running the macro above returns 'Object variable or With block variable not set' But if I end the code and do Shift+F4 to 'find again' Excel goes straight to the cell? Thanks for reading this far, and in advance for any help Matt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching a date | Excel Discussion (Misc queries) | |||
Date Range Searching | Excel Programming | |||
searching a date range. | Excel Programming | |||
Searching by date | Excel Programming | |||
searching date | Excel Programming |