Copy Paste selected columns of a row to another sheet based on a cell value of the row

  • Hi All,

    I am trying to copy paste selected rows from sheet "Request" to sheet "Month end console". If "YES" is mentioned in J column of the row, that row should be transferred to "Month end console"

    Below is the code I tried. This works correctly until a row is met which is not mentioned as "YES" in J column. Once "NO" row is met, the next immediate YES row is pasted with the previous NO row's data. Have attached the workbook herewith. Much appreciate kind support from you all!

    Many thanks!

  • Hi Logit,

    Thank you for the support! The code shared by you copy paste rows with "NO" in column J also. Do you have any idea why is that?

  • I cannot reproduce the error here. However, paste the following macro into the SHEET MODULE. Evertime

    the term YES is entered into COL J, the copy process will occur.

  • Hi Logit,

    If copy paste cell has a value which is calculated with formula, then in the pasted sheet (month end module), that value swaps with the value in previous

    "NO " row. Columns F, G, I, J have formulas hence pasted value gets changed in destination sheet it seems. Since columns A,B,C,D,E,H have no formulas it copy paste exact value (correct value).

    Could you please check it and help me to copy paste only the value excluding the formulas.

    Much thanks for the support!

  • It would be best for you to post a sample of your workbook (do not include confidential information) for download. That will allow

    for an accurate examination and provide the best solution. Thanks.

  • .

    Ok ... the following macro is functional via manual activation or auto-activation:

    With a COMMAND BUTTON you can manually activate the macro.

    If you desire to auto-activate the macro, paste the following in to the Sheet Module :

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    End Sub
  • Hi Logit,

    It works perfectly.

    Thank you very very much for your help! I am a very new person to Excel VBA. I really appreciate the support. :)

    This website and all the volunteers work here are really life savers!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!