+ Reply to Thread
Results 1 to 2 of 2

Run Time error 1004 in Excel Macro

Hybrid View

Samik23 Run Time error 1004 in Excel... 10-03-2006, 06:05 PM
Simon Lloyd Of course you understand that... 10-04-2006, 09:32 AM
  1. #1
    Registered User
    Join Date
    10-03-2006
    Posts
    1

    Run Time error 1004 in Excel Macro

    I have the following macro written within Excel 2003 and it works fine. I am not sure as to what was the original version of Excel in which this was written.
    However, a user complains that he gets a run time error 1004 as "The cell or chart you are trying to change is protected and therefore read-only ........" in his machine that runs Excel 97/2000.

    Here is the code snapshot:
    Public Sub PasteForecast()
    Sheets("Error History").Visible = True
    Sheets("Error History").Select
    Range("A2").Select
    Do Until ActiveCell.Value = Sheets("2) Forecast Worksheet").Range("C3").Value
    ActiveCell.Offset(1, 0).Select
    Loop
    ActiveCell.Offset(0, 2).Select
    Sheets("2) Forecast Worksheet").Range("C20").Copy
    Sheets("Error History").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    The code fails in the last line.

    The Error History sheet is Hidden and it has some cells as write protected like Columns B,G,H,I,J etc.

    Thanks in advance.

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Of course you understand that you cannot copy to protected sheets or cells without unprotecting them, you could unprotect the sheet first...Sheets("Error History").unprotect as long as you dont have a password.

    Regards,
    Simon

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1