+ Reply to Thread
Results 1 to 6 of 6

How to lock a cell only not allowing user change format?

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    95

    Question How to lock a cell only not allowing user change format?

    Dear Sirs,

    How to lock a cell only not allowing user change format? Allowing user paste values only?

    You know when you copy & paste from other excel form that the font and background color, etc are customized, those formats will be carried over to destination cell as well. How can I lock up the destination cell then user can only paste values?

    Thanks
    Last edited by ohlalayeah; 07-26-2012 at 12:52 AM.

  2. #2
    Registered User
    Join Date
    05-30-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: How to lock a cell not allowing user change format?

    can anyone help? Thanks!

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to lock a cell not allowing user change format?

    Not so easy. Here's an article on it.

    http://www.dailydoseofexcel.com/arch...te-operations/
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    05-30-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: How to lock a cell not allowing user change format?

    yes, very difficult.

    How can I prevent other users from pasting data which carry formatting (e.g. font style and color) from other excel form on my excel form? I want to allow users copy & paste text from other excel form but only want them to paste value (no formatting).

    What we usually do to avoid the destination cell from changing font style / color by making use of notepad (copy text to notepad and then copy to excel). Thanks

  5. #5
    Registered User
    Join Date
    05-30-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    95

    Re: How to lock a cell only not allowing user change format?

    I want to use below code, but what is the definition of "ValidationRange"? is it done by going to Insert -> Name -> Define? There is a dead-loop if to use it.


    Private Sub Worksheet_Change(ByVal Target As Range)
    'Does the validation range still have validation?
    If HasValidation(Range("ValidationRange")) Then
    Exit Sub
    Else
    Application.Undo
    MsgBox "Your last operation was canceled." & _
    "It would have deleted data validation rules.", vbCritical
    End If
    End Sub

    Private Function HasValidation(r) As Boolean
    ' Returns True if every cell in Range r uses Data Validation
    On Error Resume Next
    x = r.Validation.Type
    If Err.Number = 0 Then HasValidation = True Else HasValidation = False
    End Function

    ---------- Post added at 02:57 PM ---------- Previous post was at 01:35 PM ----------

    I have read below thread but the suggestion there doesn't work.

    http://www.excelforum.com/excel-gene...08#post2871608
    Last edited by ohlalayeah; 07-26-2012 at 01:37 AM.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: How to lock a cell only not allowing user change format?

    Ohlalayeah,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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