Consulting

Results 1 to 4 of 4

Thread: Inser a row based on the cell value in a column

  1. #1
    VBAX Regular
    Joined
    Jul 2015
    Posts
    32
    Location

    Inser a row based on the cell value in a column

    Hello Everyone,

    I need to insert a row based on the cell value in column Q. If the cell value is KAA or MAA then a row to be inserted and fill the values.

    I have a sheet with the column A to Q. For the inserted rows the values should be same as prior row for the columns A,B,C,D,G,L and for others the value to be filled from the data in the another sheet.

    For the column E, the value should be Aux if the prior value is "cont". And Colum F should be filled from the data from sheet2 based on the value from Q, E. If the cell value in column Q is "KAA" and Column E is "Aux" then the value for that should be picked from Sheet2.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Please provice a workbook with three sheets.
    Sheet 1 should have two rows with data, one with "KAA" and one with "MAA."
    Sheet 2 should have at least one row of data
    Sheet three, (Results," should look like you want sheet1 should look after the macro runs (4 rows) ecxcept, Fill the tqwo "Inserted" Rows with formulas that provide the data from the rows above and from sheet 2 that should be in them.

    Examples:
    Row 1 has "KAA":
    Range (A2) Formula = "=A1"
    Range (E2) formula = "=IF(E1="Cont","Aux",?)
    Range (F2) Formula = IF(AND(Q1="KAA),E2="Aux"),Sheet2!A1,?)

    Row 3 has "WAA":
    Repeat for Row 4
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Regular
    Joined
    Jul 2015
    Posts
    32
    Location
    Hi, I have attached the sample workbook for your reference.

    Sheet named "original" will be sheet I use, as I said in my initial post I will perform the steps.

    Sheet named "result" will be expected result. Yellow lines are the inserted lines and the values are filled from sheet2 based on the values from column G, column F and column A.

    if KAA , 201, contract for that particular value from sheet2 to be picked for the columns B,C,D,E.
    Attached Files Attached Files

  4. #4
    VBAX Regular
    Joined
    Jul 2015
    Posts
    32
    Location
    Any help pls..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •