Results 1 to 2 of 2

Disabling macros within a selected row/cell range?

Threaded View

PcKid888 Disabling macros within a... 07-19-2010, 11:21 PM
Paul Re: Macro query 07-19-2010, 11:23 PM
  1. #1
    Registered User
    Join Date
    07-19-2010
    Location
    Adelaide
    MS-Off Ver
    Excel 2003
    Posts
    2

    Smile Disabling macros within a selected row/cell range?

    Hi everyone,
    Recently I built a spreadsheet for another department for the collection of data. This is a stop gap measure while the online module is built. This department then sends this worksheet to their sub departments to complete. We also built a simple Access database to collate the data and create simple reports once returned.

    To keep the data integrity levels high I used VB code and validation rules (I found these in forums like this one). These disable right clicks, cut and paste functions and disallows any blank cells. For repeated data I put in drop down menus.

    It worked perfectly, and initially they were pretty wrapped. But now the sub departments have complained that they can’t cut and paste large amounts of data into item description columns and it’s too hard to type it in one cell at a time...If I had my way I’d tell the sub department to suck it up, but in the interests of inter departmental relations I obviously can’t.

    So the department wants the macro to allow the pasting of data, but only in one single column and only in a selected cell range of the worksheet - in this case column ‘A’ cell range ‘20:325’). The problem is I don’t know if this is possible and really require your advice on the issue.

    I have included the macro I currently use below.

    If anyone can help me I would really appreciate it.

    -------

    Private Sub Workbook_Activate()
    Application.CutCopyMode = False
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    End Sub
    
    Private Sub Workbook_Deactivate()
    Application.CellDragAndDrop = True
    Application.OnKey "^c"
    Application.CutCopyMode = False
    End Sub
    
    Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    Application.CutCopyMode = False
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    End Sub
    
    Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    Application.CellDragAndDrop = True
    Application.OnKey "^c"
    Application.CutCopyMode = False
    End Sub
    
    Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    MsgBox "Right click menu deactivated." & vbCrLf & _
    "Cannot copy or ''drag & drop''.", 16, "For this workbook:"
    End Sub
    
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
    Application.CutCopyMode = False
    End Sub
    
    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    Application.OnKey "^c", ""
    Application.CellDragAndDrop = False
    Application.CutCopyMode = False
    End Sub
    
    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    Application.CutCopyMode = False
    End Sub
    Last edited by PcKid888; 07-20-2010 at 04:08 AM. Reason: Changes requested by the mod

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