Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Why doesn't ths VBA Code work?

Help!

I can run this code from inside a simple Macro called subroutine with ARG
replaced by a string. But when I put it in another function and call it
from within my own code, I get a 424 Error, "Object required" error. And it
was running until an hour ago. Anyidea what's going on?

Many thanks,
Mac Lingo
Berkeley, CA

================================================== ===========
The Code

Range("A1").Select

Set rng = Cells.Find(What:=ARG, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Why doesn't ths VBA Code work?

I think the find isn't locating the ARG value on the activesheet. this means
then that No Object (a range) has been set and so it can't activate it.

try replacing you one liner with these extra lines:

Set rng = Cells.Find(What:=ARG, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)

If rng Is Nothing Then
MsgBox ARG & " not found on active sheet."
Else
rng.Activate
End If

HTH

Barry


"Mac Lingo" wrote:

Help!

I can run this code from inside a simple Macro called subroutine with ARG
replaced by a string. But when I put it in another function and call it
from within my own code, I get a 424 Error, "Object required" error. And it
was running until an hour ago. Anyidea what's going on?

Many thanks,
Mac Lingo
Berkeley, CA

================================================== ===========
The Code

Range("A1").Select

Set rng = Cells.Find(What:=ARG, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does this code not work? rk0909 Excel Discussion (Misc queries) 12 September 4th 08 10:42 PM
Why this code is not work? Error code when select worksheet Excel Worksheet Functions 4 December 4th 07 12:51 AM
vba code doesn't work lschuh Excel Programming 24 July 22nd 05 06:45 PM
Code Does Not Work Minitman[_4_] Excel Programming 21 December 16th 04 09:30 PM
Code Still Does Not Work Minitman[_4_] Excel Programming 8 December 14th 04 02:49 PM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"