Results 1 to 1 of 1

Add Row Delete Code in My Existing VBA

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-29-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    434

    Add Row Delete Code in My Existing VBA

    Hello Sir i m useing a VBA i wanna Add a macro in this VBA which is following

    After Copy range data from one sheet to another sheet... We cheack entire sheet.. if any row or rows found complicity Blank Than macro Remove That Road or Roads Automatically....

    Pls add that code line in following code so that we can paste in my file..

    Private Sub Worksheet_Change(ByVal Target As Range)
    'stop anything re-triggering this event macro
    Application.EnableEvents = False
    
    On Error GoTo ErrHnd
    
    'test if changed cell is in column J (col. 10) and it contains Y (or y)
    If Target.Column = 10 And UCase(Target.Text) = "Y" Then
        Dim rngCell As Range
        Dim rngDest As Range
        Dim nubRows As Long
        Dim strRowAddr As String
               
        'save target row address
        strRowAddr = Target.Address
        
        
        Dim j As Integer
           
           Sheets(1).Range("A6:j55").Copy
        Sheets("Prarup-1").Range("d" & CStr(Application.Rows.Count)).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Transpose:=False
    
     Sheets(1).Range("A65:AW65").Copy
        Sheets("Work").Range("B" & CStr(Application.Rows.Count)).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Transpose:=False    
    
        Target.EntireRow.Copy Destination:=rngDest
        'remove the cut/copy range marquee
        Application.CutCopyMode = False
         
    End If
    
    Application.EnableEvents = True
    Exit Sub
    
    'error handler
    ErrHnd:
    Err.Clear
    Application.EnableEvents = True
    End Sub

    Thanks in Advance
    Last edited by santosh226001; 05-25-2013 at 05:19 AM. Reason: Titile name mistake

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