• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Add rows based on condition

JUES

New Member
Hello friends, I hope you are well.

I need a macro that, when the workbook is opened, validates the set of records in Column O of Hoja57 (MATRIZ3). For each valid record that meets this condition (O ≥ 1), the macro should automatically insert additional rows into Row B3 of Hoja57 (MATRIZ3) according to the number of records that meet the condition O ≥ 1.

To validate records that meet the condition O ≥1, the macro must compare the data in Column F of Hoja57 (MATRIZ3) with that of Hoja62.Range("$A$9").Value (FORMATO) and the data in Column G of Sheet57 (MATRIZ3) with that of Hoja62.Range("$C$11") .Value (FORMATO). It should only consider as valid those records whose match is exact. The cells (B3:O3) of the inserted rows must be colored RGB(255, 255, 204) to avoid repeating records each time the workbook is opened. The macro must be able to distinguish whether the O ≥ 1 records have already been validated and the rows inserted in B3.

For example, if cell O3 y O4 validates the condition O ≥ 1, the cells in the new row inserted in B3 and B4 must meet the following conditions:

  • B3 = B5*
  • C3 = C5*
  • D3 = D5*
  • E3 = Hoja62.Range("$A$10").Value (FORMATO)
  • F3 = Hoja62.Range("$A$9").Value (FORMATO)
  • G3 = Hoja62.Range("$C$11").Value (FORMATO)
  • H3 = H5*
  • I3 = O5*
  • J3 = J5*
  • K3 = K5*
  • L3 = 05*
  • M3 = M5*
* Note that the row moves as new records are inserted
  • B4 = B6*
  • C4 = C6*
  • D4 = D6*
  • E4= Hoja62.Range("$A$10").Value (FORMATO)
  • F4 = Hoja62.Range("$A$9").Value (FORMATO)
  • G4 = Hoja62.Range("$C$11").Value (FORMATO)
  • H4 = H6*
  • I4 = O6*
  • J4 = J6
  • K4 = K6*
  • L4 = 0
  • M4 = M6*
* Note that the row moves as new records are inserted

I have attached an image with an example of the expected result.

I would be very grateful for any help you can give me.
 

Attachments

Back
Top