|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Error 91 on Cells.Find
I'm double-clicking on a comma-delimited (*.CSV) file to have MS Excel auto-open and import it. I then execute a VB macro to format it, however when I execute the following code I get an error 91 "Object variable or With block variable not set" on the Cells.Find.
I've been racking my brain, reading doc, etc. trying to figure it out... dim s_Search as String dim v_Address as Variant Range("A1").Activate s_Search = "PROGNAME" v_Address = Cells.Find(s_Search, ActiveCell, xlFormulas, xlWhole, xlByRows, xlNext, False, False).Address |
|
#2
|
|||
|
|||
|
mabey try
Code:
dim s_Search as String
dim v_Address as Variant
dim rngTmp as Range
set rngTmp = Range("A1")
rngTmp.Activate
s_Search = "PROGNAME"
v_Address = rngTmp.Cells.Find(s_Search, ActiveCell, xlFormulas, xlWhole, xlByRows, xlNext, False, False).Address
this way you have set a object variable pointing specificaly to your range, therefore setting the object var it is complaining about Last edited by garman : April 25th, 2008 at 03:03 AM. |
|
#3
|
|||
|
|||
|
User Error
What I discovered is that my comma-delimited file wasn't comma-delimited...I had downloaded the wrong file.
Which explains why the string was not found. That only took about 2+ hours to figure out... The only positive thing is that it revealed that I am missing a bunch of exception logic in my code. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Error 91 on Cells.Find |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|