PDA

View Full Version : Copy Cell Values to Columns if Criteria is Matched in VBA



aaronws
10-17-2018, 04:25 PM
Hello everyone,

Thank you in advance for any help you may provide. Please see attached Excel for reference to my question below. I greatly appreciated.


In a set of values in Excel, Column I, I am trying to use VBA to automatically identify cell value changes going from a value of 1 to 0, OR a value of 0 to 1.

If it is identified that in the column a value changes from 1 to 0, I would like to copy the Start Time on the same row where the 0 is located. The value would be copied to the next available row in Column B.

If it is identified that in the column a value changes from 0 to 1, I would like to copy the End Time on the same row where the 1 is located. The value would be copied to the next available row in Column C.

This would be done until the values in the Column I no longer changes.

I would appreciate any help. Please let me know if you have any questions.

Thank you very much.

tttin20
10-19-2018, 02:44 AM
Dear aaronws,

My solution:

Step1: check where row is "start" and "end" in "System OK Status - Event 016" table.

Step2: filter and get "start" and "end" rows, then paste them to another sheet.

Step3: you will see a pair "start-end" rows sequently, so just fill "end" date of "end" row to "start" row.

Step4: filter and get "start" rows.

I attached the Excel file that I did, may solve your request.