Copy and paste a certain range ( total 3 rows) based on the value of different cells

manojrf

Board Regular
Joined
Mar 28, 2011
Messages
107
Hi everyone,

Appreciate if anyone could help me with the macro that I have. When I use this, sometimes the process of copying and pasting becomes more than once ( 2 or 3 times).

'Accounts opened

Sheets("DATA").Select
If Range("AB81").Value > 0 Then
Sheets("Accounts opened").Range("A1:E1").Copy
Worksheets("Accounts opened").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
Else
End If


'Accounts closed

Sheets("DATA").Select
If Range("Z89").Value > 0 Then
Sheets("Accounts closed").Range("A1:E1").Copy
Worksheets("Accounts closed").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
End If

Sheets("DATA").Select
If Range("Z90").Value > 0 Then
Sheets("Accounts closed").Range("A2:E2").Copy
Worksheets("Accounts closed").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False
End If

Sheets("DATA").Select
If Range("Z91").Value > 0 Then
Sheets("Accounts closed").Range("A3:E3").Copy
Worksheets("Accounts closed").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, operation:=xlNone, skipblanks:=False, Transpose:=False

Else

End If

Please help me out. Thank you
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,786
Messages
6,121,548
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top