Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Application-Defined or Object-Defined Error on simple code

I seem to continually struggle with this error anytime I write vba code
for excel.

I have the following code:

Private Sub cmdUpdate_Click()

Workbooks("Inventory").Worksheets("RawData").Colum ns("G").Replace
What:="{01", Replacement:="Newton", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

This code runs when a user clicks a command button but always gives me
the application-defined or object-defined error. Others who have
tried to help me say they cannot replicate the error. Is anyone else
struggling with this?

Thanks,

Brent

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Application-Defined or Object-Defined Error on simple code

If the button is on a worksheet, and you are in Excel97, change
the TakeFocusOnClick property to False. This is a bug that was
fixed in 2000.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Fid" wrote in message
ps.com...
I seem to continually struggle with this error anytime I write
vba code
for excel.

I have the following code:

Private Sub cmdUpdate_Click()

Workbooks("Inventory").Worksheets("RawData").Colum ns("G").Replace
What:="{01", Replacement:="Newton", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
End Sub

This code runs when a user clicks a command button but always
gives me
the application-defined or object-defined error. Others who
have
tried to help me say they cannot replicate the error. Is
anyone else
struggling with this?

Thanks,

Brent



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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error -[::::Shamran::::]- Excel Programming 7 June 7th 05 02:14 PM
Application-Defined or Object-Defined Error on simple code [email protected] Excel Programming 6 February 22nd 05 09:03 PM
Application-defined or object-defined error - missing the basics [email protected] Excel Programming 1 December 28th 04 10:23 PM
Macro Run-time Error 1004 Application Defined or Object Defined Error Anddmx Excel Programming 6 June 9th 04 03:40 PM


All times are GMT +1. The time now is 04:49 PM.

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

About Us

"It's about Microsoft Excel"