Results 1 to 3 of 3

Worksheet change event copy paste dont call a macro

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-01-2012
    Location
    ZA
    MS-Off Ver
    Excel 2013
    Posts
    300

    Worksheet change event copy paste dont call a macro

    I dont get this to work can someone tell me what need to change for it to work....I have a macro CopyHis thats called only if cells B2-G2 is triggered(changed) by a copy paste. If I manually go change 1 digit it runs through but a copy and paste dont trigger it.....Rep given fo a solution that help it to trigger a change due to copy and paste

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    
        Application.EnableEvents = False
        If Target.CountLarge > 1 Then Exit Sub
        If Target.Value = vbNullString Then Exit Sub
        
        If Not Intersect(Range("B2:G2"), Target) Is Nothing Then
            CopyHis                                                                    ' Macro thats been called on a change on B2-G2 due to copy and paste
        Application.EnableEvents = True
            
        
        End If
    
        
    End Sub
    
     
    Sub CopyHis()
    '
    ' CopyHis Macro
    '
    
     Dim wb As Workbook
        Set wb = Application.Workbooks(Figures.xlsm")
        wb.Activate
        'wb.Sheets("Sheet1").Range("A1").Select  'No error.
    
    
    
        Sheets("HistoryD").Select
        ActiveSheet.Unprotect Password:="sd2299"
        Columns("A:G").Select
        Selection.Copy
        Sheets("HistoryDD").Select
        Sheets("HistoryDD").Range("A1").PasteSpecial Paste:=xlPasteValues
        wb.Sheets("HistoryDD").Rows("2:2").Select
        Application.CutCopyMode = False
        Selection.Delete Shift:=xlUp
        wb.Sheets("Skips").Select
        wb.Sheets("Skips").Range("F5:J5").Select
        Application.CutCopyMode = False
        Selection.Copy
        Sheets("HistoryD").Select
        Range("J2").Select
        Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
    End Sub
    Last edited by ricklou; 01-23-2017 at 06:12 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Change Event Call Macro with MS Table Query
    By Redled89 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2016, 11:04 PM
  2. Replies: 4
    Last Post: 12-18-2014, 12:01 PM
  3. [SOLVED] Cannot paste to another worksheet in private sub change event
    By LouiseH24 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-10-2012, 06:58 AM
  4. How Do I call a Macro Using the ComboBox Change Event?
    By Bosco6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2011, 06:20 PM
  5. Combo Box Change Event with Macro Call
    By Bosco6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2011, 02:40 PM
  6. Event change copy paste
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2010, 03:09 PM
  7. Change event copy & paste
    By Mr. Dan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2006, 05:50 PM

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