PDA

View Full Version : VBA assistance required for copy values



nicky32
07-24-2014, 11:20 AM
Hi - Id be very grateful for any assistance with this issue - FYI, I have zero knowledge of VBA so I'm hoping for a bells and whistles piece of code that I can just cut and paste into the VBA code place!!

I have 2 sheets.

First Sheet is called "A".
Second Sheet is called "ResA"

I want to copy values from "A" and paste to "ResA".

Specifically, when cell AB4 in Sheet A = "END", then I want to copy and paste the values in sheet A - A5:AG30 to the cell (indirect) referenced on sheet A - AD3 (eg ResA!A8) in sheet ResA. Cell AB4 (macro trigger) is formula driven and may say "END" periodically, and each time I want to trigger the macro.

Hope that's reasonably clear. It appears to be quite complex to me, so Id really appreciate a dig out.

Thanks very much

N32

westconn1
07-24-2014, 02:53 PM
may say "END" periodically,in that case you would need to check its value in the worksheet selection change event, then run the code when criteria matches like

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("ab4").Value = "End" Then ' copy cells
End Sub

if you need the cells to copy, even if there is no user interaction, then you may need to use application.ontime

in either case you may need to know if the cells were already copied during this period of ab4 value being "end", so it will only copy once during the cycle

nicky32
07-25-2014, 01:31 AM
Westconn1 - thank you for thr reply. The copy will not get into a loop as I have built this possibilty into the "END" formula - ie if the data in A5:AG30 has already been copied, AB4 will not = "END". Does that address your query? N32