PDA

View Full Version : Code that detects data in cells and pastes data into the next cells



Chill98
12-17-2019, 06:16 AM
Does anyone have any advice on how I can have some code that will copy certain cells for example A3 D3 and E3 and paste them into for example J3, K3 and L3. But as it would be pasted into a table that is have the dates running down the I column. The code would have to detect that there is already data in J3, K3 and L3 and paste it into J4, K4 and L4 and then the next day the code would need to detect there is data in J3-4, K3-4 and L3-4 and would need to paste it into J5 etc and so on. Been trying to figure this out for ages now so any help would be greatly appriciated.

Thank you.

p45cal
12-17-2019, 08:48 AM
try
Set Destn = Cells(Rows.Count, "J").End(xlUp).Offset(1)
Range("A3,D3:E3").Copy Destn
Be aware that if ever A3 is blank when it's copied, the next time the destination cell will be the same cell.

Chill98
12-17-2019, 09:20 AM
try
Set Destn = Cells(Rows.Count, "J").End(xlUp).Offset(1)
Range("A3,D3:E3").Copy Destn
Be aware that if ever A3 is blank when it's copied, the next time the destination cell will be the same cell.

p45cal
12-17-2019, 09:26 AM
I get no error here. Where are you placing the code?