Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run-time error '1004' VBA Excel 2003


Help. I'm fairly new to VBA and can not figure what the problem is.

The following code gives me the run-time error '1004'.


ThisWorkbook.Sheets("Next").Activate

' Find and remove "(Query 1 with OBNatAc5)" in headers
Rows("1:1").Select
Selection.Replace What:="(Query 1 with OBNatAc5)", Replacement:="",
_
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False


--
pltang
------------------------------------------------------------------------
pltang's Profile: http://www.excelforum.com/member.php...o&userid=36552
View this thread: http://www.excelforum.com/showthread...hreadid=563042

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-time error '1004' VBA Excel 2003

What version of excel are you using?

If you're using xl97 and running the code from a command button placed on a
worksheet, then change that command button's .takefocusonclick property to
false.

=====
if your code is behind a worksheet, try not to do the selecting:

thisworkbook.sheets("next").Rows("1:1").Replace _
What:="(Query 1 with OBNatAc5)", Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False



pltang wrote:

Help. I'm fairly new to VBA and can not figure what the problem is.

The following code gives me the run-time error '1004'.

ThisWorkbook.Sheets("Next").Activate

' Find and remove "(Query 1 with OBNatAc5)" in headers
Rows("1:1").Select
Selection.Replace What:="(Query 1 with OBNatAc5)", Replacement:="",
_
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False

--
pltang
------------------------------------------------------------------------
pltang's Profile: http://www.excelforum.com/member.php...o&userid=36552
View this thread: http://www.excelforum.com/showthread...hreadid=563042


--

Dave Peterson
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 1004 When running in 2003 Lakshman Excel Discussion (Misc queries) 10 January 17th 07 06:06 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 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
Run-time error '1004' running to excel objects at once Dianna Braden Excel Programming 0 October 16th 03 08:55 PM


All times are GMT +1. The time now is 05:27 AM.

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"