Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find Bug that's very strange
I hope someone can explain this as we're stratching our heads here.
I have named a string variable strCurrentDate that concatenates data together to form the following date format: dd/mm/yyyy. What it is then meant to do is go to a workbook and find that date in that format. So for example 01/06/2007. The macro is getting as far as activating the workbook and putting the date in the find function but is then coming back with: Run-time error '91' Object variable or with block variable not set What is happening here? Why can't it find the date that I'm looking for? When I stop the macro and go in to the workbook and hit Ctrl+F the date has already been pasted in. If I simply press Find Next it finds it no problem. So why does the macro stop before doing that? It is pointing at the correct workbook and activating it so its no that. Any help would be much appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find Bug that's very strange
You might want to paste your code into the thread so we can have a go at
debugging it. Possibilities: you've put quotes around the date when you don't need to; you haven't included every argument the Find code needs (try re-recording a macro finding a sample date and use the whole of that line). "carl" wrote: I hope someone can explain this as we're stratching our heads here. I have named a string variable strCurrentDate that concatenates data together to form the following date format: dd/mm/yyyy. What it is then meant to do is go to a workbook and find that date in that format. So for example 01/06/2007. The macro is getting as far as activating the workbook and putting the date in the find function but is then coming back with: Run-time error '91' Object variable or with block variable not set What is happening here? Why can't it find the date that I'm looking for? When I stop the macro and go in to the workbook and hit Ctrl+F the date has already been pasted in. If I simply press Find Next it finds it no problem. So why does the macro stop before doing that? It is pointing at the correct workbook and activating it so its no that. Any help would be much appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find Bug that's very strange
Try Cells.Find(CDate(strCurrentDate))
"carl" wrote in message ... I hope someone can explain this as we're stratching our heads here. I have named a string variable strCurrentDate that concatenates data together to form the following date format: dd/mm/yyyy. What it is then meant to do is go to a workbook and find that date in that format. So for example 01/06/2007. The macro is getting as far as activating the workbook and putting the date in the find function but is then coming back with: Run-time error '91' Object variable or with block variable not set What is happening here? Why can't it find the date that I'm looking for? When I stop the macro and go in to the workbook and hit Ctrl+F the date has already been pasted in. If I simply press Find Next it finds it no problem. So why does the macro stop before doing that? It is pointing at the correct workbook and activating it so its no that. Any help would be much appreciated. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cells.Find Bug that's very strange
Did you sort out your problem, if your date system is International I rather
suspect you didn't. Regards, Peter T "carl" wrote in message ... I hope someone can explain this as we're stratching our heads here. I have named a string variable strCurrentDate that concatenates data together to form the following date format: dd/mm/yyyy. What it is then meant to do is go to a workbook and find that date in that format. So for example 01/06/2007. The macro is getting as far as activating the workbook and putting the date in the find function but is then coming back with: Run-time error '91' Object variable or with block variable not set What is happening here? Why can't it find the date that I'm looking for? When I stop the macro and go in to the workbook and hit Ctrl+F the date has already been pasted in. If I simply press Find Next it finds it no problem. So why does the macro stop before doing that? It is pointing at the correct workbook and activating it so its no that. Any help would be much appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Strange, Irregular Merge of Cells | Excel Discussion (Misc queries) | |||
find and replace macro strange behaviour | Excel Discussion (Misc queries) | |||
Strange AutoProtecting of cells | Excel Programming | |||
What is this Strange Characet? Find/Replace | Excel Programming | |||
Strange results using .FIND in Excel VBA | Excel Programming |