+ Reply to Thread
Results 1 to 5 of 5

Preventing Overwrite of Cell with Formula

Hybrid View

  1. #1
    Registered User
    Join Date
    04-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Preventing Overwrite of Cell with Formula

    Hi All,

    Is it possible to prevent overwrite of a cell that contains a formula when new values are copied from another worksheet(other workbook).

    Also do note, The worksheet can contain more then one cells that have contain formula and these cells can be non-adjacent.

    Any idea!!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Preventing Overwrite of Cell with Formula

    can't you use sheet protection?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Preventing Overwrite of Cell with Formula

    I havent tried that...at the moment i was trying doing

    SpecialCells function which didnt work because, it is not possible to copy over non-adjacent cells.

    Then if i check all cells one by one it takes ages to complete.

    I will give protection a go and see what happens

    About the protection. Does the protection allow us to protect cells with formula and prevent their overwrite but allow overwrite of all rest of the cells?

  4. #4
    Registered User
    Join Date
    04-14-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Preventing Overwrite of Cell with Formula

            bsht = bBk.Sheets("MISC2")
            to2 = bsht.Range("A1")
            asht = abk.Sheets("MISC2")
            from = asht.Range("A1:IV2000")
            Sheet14.Activate()
            Sheet14.Select()
            Sheet14.Application.Selection.Locked = False
            Sheet14.Application.Selection.FormulaHidden = False
            Sheet14.Application.Selection.SpecialCells(Excel.XlCellType.xlCellTypeFormulas, 23).Select()
            Sheet14.Application.Selection.Locked = True
            Sheet14.Application.Selection.FormulaHidden = False
            Sheet14.Protect()
            from.Copy(to2)
    The above should protect the cells but it fails on the last line and says that the cells are protected. Is it possible to protect just the cells which contain formulas?

    Anyone any idea

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Preventing Overwrite of Cell with Formula

    Sheet protection protects the whole sheet. You lock the cells that contain formulas.

    It might help to attach a workbook

+ 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