+ Reply to Thread
Results 1 to 1 of 1

Protecting New Cells Within a Macro

  1. #1
    Registered User
    Join Date
    08-18-2014
    Location
    Chicago, IL
    MS-Off Ver
    MS Office 2010
    Posts
    5

    Protecting New Cells Within a Macro

    I have been battling with this sheet for a couple of weeks and need to finish this off by protecting some cells. I have an existing macro button to add cells with V-lookups. Only problem is it pulls these V-lookups by copying the cell below it. They aren't protected, and this sheet will be used by multiple people meaning it will break often.

    How do I copy a cell format within a macro and protect the new row that was just added? I want to protect columns C, F and J starting with row 4.

    Here is my current code:

    Private Sub CommandButton1_Click()

    Rows("4:4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("C5").Copy
    Range("C4").PasteSpecial Paste:=xlPasteFormulas
    Range("F5").Copy
    Range("F4").PasteSpecial Paste:=xlPasteFormulas
    Range("K5").Copy
    Range("K4").PasteSpecial Paste:=xlPasteFormulas
    Range("J5").Copy
    Range("J4").PasteSpecial Paste:=xlPasteFormulas
    Application.CutCopyMode = False

    End Sub

    Any help would be amazing!
    Last edited by Ebarron; 08-26-2014 at 12:28 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Protecting Specific Cells Macro
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-10-2013, 10:42 AM
  2. MACRO for protecting certain cells
    By yasir.jawed in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2012, 11:41 AM
  3. Trouble Protecting Cells in a Macro
    By KClark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2011, 12:30 PM
  4. Macro Hide Row & Protecting Cells
    By MattG in forum Excel General
    Replies: 0
    Last Post: 03-31-2010, 04:51 PM
  5. [SOLVED] Protecting merged cells via Macro
    By Shane in Canberra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2006, 03:35 AM

Tags for this Thread

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