Consulting

Results 1 to 5 of 5

Thread: How to prevent copying of cell data

  1. #1
    VBAX Newbie
    Joined
    Aug 2007
    Posts
    2
    Location

    How to prevent copying of cell data

    I would like requesting helps. Please tell me how to prevent copying cell data on excel using VBA code Thanks

  2. #2
    VBAX Mentor anandbohra's Avatar
    Joined
    May 2007
    Location
    Mumbai
    Posts
    313
    Location
    do this
    & note before running this macro click on blank cell first

    [VBA]Sub prevent_copy()
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    ActiveSheet.EnableSelection = xlNoSelection
    End Sub
    [/VBA]

  3. #3
    VBAX Newbie
    Joined
    Aug 2007
    Posts
    2
    Location
    I have tried that script, yes we can't select the cell but if I right click the cell then select copy and paste on another excel sheet, the content of the cell was pasted

    I'm trying to use this script
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Rows.Count > 1 or Target.Columns.Count>1 Then _
    Cells(Target.Row, Target.Column).Select Application.CutCopyMode_
    = False
    End Sub



    But Not work, Please your suggestion. Thanks

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You could remap the Copy buttons on File and right-click and re-assign Ctrl-C.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Mentor anandbohra's Avatar
    Joined
    May 2007
    Location
    Mumbai
    Posts
    313
    Location
    for that only i told u to select blank cell before executing this macro then it will copy the data but there will be no records to paste & because of protection he can not further select the data in protect sheet

    his selection will be limited to first selected cell only before executing the macro

Posting Permissions

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