If and Else Copy & Paste

zgivod

New Member
Joined
Dec 6, 2018
Messages
17
1 Copy only the text of a range (A1:A20) on sheet 1
2 paste that text on the next empty row on sheet 2

I would give my code buts its all rubbish because as far as i got was to copy the whole range and paste it on sheet 2
with spaces
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try this:
Not sure why you think we need:
If and Else

Code:
Sub Copy_Me()
'Modified  12/13/2018  3:24:12 PM  EST
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets(1).Range("A1:A20").Copy Sheets(2).Cells(Lastrow, 1)
Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
If you want it without blanks, try
Code:
Sub zgivod()
Sheets("sheet1").Range("A1:A20").SpecialCells(xlConstants).Copy _
   Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
This assumes that sheet1 has values rather than formulae.
 
Upvote 0

Forum statistics

Threads
1,216,081
Messages
6,128,695
Members
449,464
Latest member
againofsoul

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