PDA

View Full Version : Macro to copy values from one sheet to another based on specific conditions



shavi8413
05-08-2016, 02:43 AM
Hi Guys,

I am new to this forum. I need your help in writing a macro.

I have two sheets – “Formula” and “Values”. I input some values on daily basis in “Formula” sheet. I input date in cell A2 and values in cells B2, C2, D2, E2 and F2. The date and values keep on changing every day. Based on these values, I generate four output based on the calculations.

First Output – H12 to AX12
Second Output – H13 to AX13
Third Output – H14 to AX14
Fourth Output – H15 to AX15

The conditions to copy first output is mentioned in cells D12 and E12. If both the conditions satisfy, then we have text “Copy” in F12 otherwise there is “Don’t Copy”. The conditions to copy second output is mentioned in cells D13 and E13. If both the conditions satisfy then we have text “Copy” in F13 otherwise there is “Don’t Copy”. Similarly, the conditions for third and fourth output are mentioned in the "Formula" sheet.

Now what I want macro to do is whenever there comes text “Copy” in any of the cells from F12 to F15 (there would be only one cell containing text “Copy” at a given date), the macro selects values from corresponding H cell to AX cell from “Formula” sheet and paste them in “Values” sheet from cell C to AS for the respective date mentioned in cell A2 of “Formula” sheet.

“Values” sheet is for record purpose where column A contains Date.

Regards,
Shaveen

PAB
05-09-2016, 02:27 PM
Hi shavi8413, welcome to the board :yes .

Perhaps you could attach a WorkSheet file so we can better understand your request?