Results 1 to 5 of 5

VBA code suddleny producing an error

Threaded View

drgogo VBA code suddleny producing... 04-15-2010, 05:42 AM
romperstomper Re: VBA code suddleny... 04-15-2010, 06:34 AM
drgogo Re: VBA code suddleny... 04-15-2010, 06:54 AM
romperstomper Re: VBA code suddleny... 04-15-2010, 06:58 AM
drgogo Re: VBA code suddleny... 04-15-2010, 07:18 AM
  1. #1
    Forum Contributor
    Join Date
    01-29-2008
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    237

    VBA code suddleny producing an error

    Help..

    the code listed below, has been working for well over a year, as its the original code that was created when i developed my spreadsheet. Now i have been making improvments through out the year, but never had a problem.

    Sub InsertARow()
    '
    ' InsertARow Macro
    ' Macro recorded 01/09/2008 by v14dmin
    '
    ' Keyboard Shortcut: Ctrl+i
    
    If ActiveSheet.Name <> "Timetabled Service" Then Exit Sub
    
    ActiveSheet.Unprotect ("gideon")
    Worksheets("Frequent Calculate").Unprotect ("gideon")
    ActiveCell.EntireRow.Insert
    ActiveCell.End(xlToLeft).Select
    Range("Master_Row").Copy Destination:=ActiveCell
    
    
    Worksheets("Frequent Calculate").Protect ("gideon")
    ActiveSheet.Protect ("gideon"), DrawingObjects:=True, Contents:=True, Scenarios:=True _
            , AllowInsertingRows:=True, AllowDeletingRows:=True, AllowSorting:=True
    
    
    '
    End Sub
    Now when the code gets excuted, I am presented with a run time error, stating that the sheet im trying to alter is protected etc

    The line it then highlights is

    Range("Master_Row").Copy Destination:=ActiveCell
    The code does what its suppose to do i.e. insert a line from another sheet, then it produces the error, The active sheet is protected, but the sheet where the line comes from is no longer protected. Also I find that two of the cells within the line that is copied over, do not have there formulas in.

    Now i cant work out why this is happening, as its never had any problems before

    Any help or ideas why... ??

    G
    Last edited by drgogo; 04-16-2010 at 03:50 AM. Reason: Update, to save mess

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