Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Error 1004 in Excel 97...

A colleague uses Excel 97, and received an error "1004 application-defined or object-defined error" running a workbook that works fine in Excel 2000. Frustratingly, their version of excel doesn't permit me to edit/view the code, and the debug button is greyed out... even when i supplied a password-deprotected version
Anyway, by deduction the code stops at

Selection.Replace What:=y1, Replacement:="", LookAt:=xlWhole,
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=Fals

This sub is defined as

Option Explici
Dim y1 As Varian
Sub code(
Sheets("Sheet2").Selec
y1 = Sheets("Sheet1").Cells(1,1).Valu
Sheets("Malcoded").Columns("A:A").Selec
Selection.Replace What:=y1, Replacement:="", LookAt:=xlWhole,
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=Fals
...

Presumable something to do with how i have defined "y1", or how i hav selected the range to operate on
Any ideas... can't debug this one on their PC and no Excel 97 to test
TI

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error 1004 in Excel 97...

In Excel 97 the Replace function has these arguments:

expression.Replace(What, Replacement, LookAt, SearchOrder, MatchCase,
MatchByte)

It doesn't have a Searchformat or Replaceformat argument, so it chokes.

Since you aren't using those arguments, just remove them.

--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
A colleague uses Excel 97, and received an error "1004 application-defined

or object-defined error" running a workbook that works fine in Excel 2000.
Frustratingly, their version of excel doesn't permit me to edit/view the
code, and the debug button is greyed out... even when i supplied a
password-deprotected version !
Anyway, by deduction the code stops at:

Selection.Replace What:=y1, Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

This sub is defined as:

Option Explicit
Dim y1 As Variant
Sub code()
Sheets("Sheet2").Select
y1 = Sheets("Sheet1").Cells(1,1).Value
Sheets("Malcoded").Columns("A:A").Select
Selection.Replace What:=y1, Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
...

Presumable something to do with how i have defined "y1", or how i hav

selected the range to operate on.
Any ideas... can't debug this one on their PC and no Excel 97 to test.
TIA

Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Error 1004 in Excel 97...

Many thanks Tom

I cut those properies and i'll see if it works when someone can test it - i'm sure it will be fine
On a similar note - are there any good resources to easily find those properties that are supported/unsupported by various flavours of Excel - would help for these problems greatly
many thanks again

Mike
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error 1004 in Excel 97...

Not really - obviously using xl97 to check - the best approach is to develop
in the lowest version that will use the code.



--
Regards,
Tom Ogilvy

"Mike" wrote in message
...
Many thanks Tom,

I cut those properies and i'll see if it works when someone can test it -

i'm sure it will be fine.
On a similar note - are there any good resources to easily find those

properties that are supported/unsupported by various flavours of Excel -
would help for these problems greatly.
many thanks again.

Mike



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
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Error 1004 in Excel 2000 YaakovSinai Excel Programming 0 April 18th 04 03:46 PM
EXCEL VBA - Run-time Error 1004 sakieboy Excel Programming 5 January 30th 04 03:47 PM
EXCEL VBA - Run-time Error 1004 sakieboy[_3_] Excel Programming 0 January 29th 04 02:27 PM
Excel Formula - Error 1004 - Bug? Mistake? Markus Wilthaner Excel Programming 3 December 17th 03 02:25 AM


All times are GMT +1. The time now is 05:36 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"