Copy rows and insert nth times then edit cells

Closed
alex - Jan 2, 2015 at 12:40 PM
Hello,

i need a VBA macro to do the following
i have a variant number of rows, i want to copy and then insert the row n times depend on a value, that value is the deference between the hour in column Q and P for each row, note that i have a date/time format in columns P,Q, then if the deference between hours is zero or if its 1 and the minute and second in column Q is zero then skip this row, but if the deference between hours is 1 and the minute and second in column Q are not zero then i want to copy the row and insert it below the original one and then change the value in column Q related to the original row to be the same as in column P + 1 hour while minute & second of that value should be zeros, and also to set the value in column P of the copied row to be the new value in column Q of the original row, but if the hour deference is more than one, do the same process but in the Q column of the copied rows it should be the new value in column P + 1 hour while minute & second of that value should be zeros but the last copied row should have in column Q the original value which was in column Q before editing.

it is somehow splitting rows based on hourly

if above is achieved then i want another macro to do sumifs
i want the second macro to sum all values in column H depends on conditions (hour in column B, node in column E, category in column J, planned in column K) after that happened i want to delete duplicate data.

a third macro needed to check the existing hours in column B and then add rows of the non existed hours (0-23) and fill the columns with "-" except column A which should contains date and B contains hour and H filled with zero "0"

your help highly appreciated