Please check my code & tell me where i'm doing it wrong. Cant make it work. Small code. Thanks

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
I dont know why my code does not leave a row before pasting....
please check where is it wrong.
Thanks ped;)

Code:
sub try1()
Selection.Copy
          Sheets("Data").Select
          Range("b2").Select
          Do Until ActiveCell.Value = ""
          ' i have place (1,0) to leave 1 row before pasting...
          ActiveCell.Offset(1, 0).Select
          Loop
activesheet.paste
end sub
 
pedie

How can somebody redesign the code without knowing what it's meant to do?

I can, and probably will, rewrite the code to get rid of the Select etc but I can't guarantee it'll do what you want.
Code:
Sub try1()

    Sheets("Sheet1").Range("B2").CurrentRegion.Copy
    Sheets("Data").Range("B" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteAllUsingSourceTheme

End Sub
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Pedie, with 400 + posts, you've got to stop using Select
Code:
Sub CopyMe()
Sheet(Sheets1).CurrentRegion.Copy Sheets("Data").Range("B" & Cells(Rows.Count, "B").End(xlUp).Row +1)
End Sub
ONE LINE
You might need 2 lines if you're doing a PasteSpecial
lenze
 
Upvote 0
Thanks everyone!

Now it worked....All because you guys helped...!!!!:biggrin:

My dad says 'm MAD with excel these days...:biggrin:

Thanks again!!!
 
Upvote 0
Brian...thank you so much...I didnt get time the other day to check in back. That was vry helpfull. If anyone sees then check out the second link it is very usefull...yea only for person like me...:biggrin:
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,126
Members
452,381
Latest member
Nova88

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