LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run-time Error '1004'


Hi all,

I've just recorded (what I think is) is a fairly simple macro. It's
basically making a few changes to a list of teams, for a number of
project reports.

However, a couple of weird things are now occuring (I did this before
and it worked fine).

The first oddity is that when I run the macro in another workbook it
simply repeats the actions in the source workbook - before it was
changing the desired spreadsheet.

Secondly, I am sometimes getting a "Run-time error '1004'". It then
says that the 'cell or chart you are trying to change is protected and
therefore read only'. What is doubly odd is that I have made sure that
I am removing the protection on both the source worksheet and the
target worksheet.

I've copy and pasted the macro code below. When I run a debug it points
to the coloured text as the source of the problem.

Sub TeamChange()
'
' TeamChange Macro
' Macro recorded 25/01/2006 by RAC User
'
' Keyboard Shortcut: Ctrl+w
'
ActiveSheet.Unprotect
Windows("Monthly Status Report Template v.2.0.xls").Activate
Selection.Copy
Windows("Services Synergy 2 - Sell RAC_BSM to NUGI
Base.xls").Activate
Cells.Select
Range("F1").Activate
ActiveSheet.Paste
ActiveWindow.LargeScroll ToRight:=1
Range("A1:R1").Select
Range("R1").Activate
Application.CutCopyMode = False
ActiveWorkbook.Names.Add Name:="team",
RefersToR1C1:="=Teams!R1C1:R1C18"
Range("A1:R19").Select
Range("R1").Activate
Selection.CreateNames Top:=True, Left:=False, Bottom:=False,
Right:= _
False
ActiveWindow.LargeScroll ToRight:=-1
ActiveWindow.ScrollColumn = 1
ActiveWindow.LargeScroll Down:=4
Range("A164:E262").Select
ActiveWorkbook.Names.Add Name:="look_up", RefersToR1C1:= _
"=Teams!R164C1:R262C5"
Sheets("Resources").Select
Range("B6").Select
With Selection.Validation
..Delete
..Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:="=team"
..IgnoreBlank = True
..InCellDropdown = True
..InputTitle = ""
..ErrorTitle = ""
..InputMessage = ""
..ErrorMessage = ""
..ShowInput = True
..ShowError = True
End With
ActiveWindow.LargeScroll ToRight:=-1
Selection.AutoFill Destination:=Range("B6:B102"),
Type:=xlFillDefault
Range("B6:B102").Select
ActiveWindow.LargeScroll ToRight:=1
ActiveWindow.LargeScroll Down:=-2
ActiveWindow.ScrollRow = 6
Range("T6").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC3,look_up,2,FALSE)"
Selection.AutoFill Destination:=Range("T6:W6"),
Type:=xlFillDefault
Range("T6:W6").Select
Selection.AutoFill Destination:=Range("T6:W102"),
Type:=xlFillDefault
Range("T6:W102").Select
ActiveWindow.LargeScroll ToRight:=-1
Range("C102").Select
ActiveWindow.LargeScroll ToRight:=0
Selection.ClearContents
Range("B102").Select
Selection.ClearContents
ActiveWindow.LargeScroll Down:=-3
Sheets("Teams").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub

Can anyone suggest what I'm doing wrong, or what needs to be changed?

TIA,

SamuelT


--
SamuelT
------------------------------------------------------------------------
SamuelT's Profile: http://www.excelforum.com/member.php...o&userid=27501
View this thread: http://www.excelforum.com/showthread...hreadid=504822

 
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, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
Run time error 1004 General ODCB Error Kevin Excel Programming 3 February 26th 05 12:51 PM
Application Run Time Error 1004 and Stack Error ExcelMonkey[_190_] Excel Programming 9 February 11th 05 04:48 PM


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