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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,215,432
Messages
6,124,858
Members
449,194
Latest member
HellScout

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