Closed Thread
Results 1 to 4 of 4

please help me to run this macro as per the requirement

  1. #1
    Registered User
    Join Date
    03-28-2013
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    18

    please help me to run this macro as per the requirement

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const Prod_PWD = "123"
    Dim i As Long

    If Target.Column = 20 And Target.Row > 5 And Not Updating Then
    If MsgBox("Add new row?", vbYesNo, "Change Sheet") = vbYes Then
    Updating = True
    ActiveSheet.Unprotect Password:=Prod_PWD

    Rows(ActiveCell.Row & ":" & ActiveCell.Row).Insert
    Cells(ActiveCell.Row, ActiveCell.Column) = Cells(ActiveCell.Row + 1, ActiveCell.Column)
    Cells(ActiveCell.Row + 1, ActiveCell.Column) = ""
    For i = 1 To 12
    Cells(ActiveCell.Row, i).Formula = Cells(ActiveCell.Row - 1, i).Formula
    Next i
    CopyCells 17
    CopyCells 19
    CopyCells 25
    CopyCells 26
    CopyCells 27
    CopyCells 28
    CopyCells 29
    CopyCells 30
    CopyCells 32
    Cells(ActiveCell.Row, 20).Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:=Prod_PWD
    Updating = False
    End If
    End If
    End Sub

    Sub CopyCells(ColNum As Long)
    Cells(ActiveCell.Row - 1, ColNum).Select
    Selection.Copy
    Cells(ActiveCell.Row + 1, ColNum).Select
    ActiveSheet.Paste
    End Sub
    The above code runs wrongfully i want that if in the target column any cell having text "rejected" than auto insert row below that with formula.

    Please rectify the above code and send me as soon as possible..

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: please help me to run this macro as per the requirement

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

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

    Re: please help me to run this macro as per the requirement

    Also,

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    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]

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

    Re: please help me to run this macro as per the requirement

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.

Closed 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