Copy and Paste

Roses8

Active Member
Joined
Aug 4, 2005
Messages
348
Hi, im trying to copy and paste from A1 to I and till last row and paste into sheet 1 in A1 last row, but when it copies it selects empty cells and does not paste correctly.

Thanks. :)

Sub Macro1()

lastrow = Range("A65000").End(xlUp).Row

Sheets("Qry_Hse_Business_BSM").Select
Range("A1:I1" & lastrow).Copy
Sheets("Sheet1").Select
Range("A1" & lastrow + 1).PasteSpecial (xlPasteValues)
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I dont know if it will help but try to change:
Code:
 Range("A1:I1" & lastrow).Copy
to
Code:
Range("A1:I" & lastrow).Copy
 
Upvote 0
Hi thanks, but when i want it to paste, it paste on column A but row 18 and i dont know why, when it should paste in A1, otherwise look for the next empty row then paste in column A.


Sub Macro1()

lastrow = Range("I65000").End(xlUp).Row

Sheets("Qry_Hse_Business_BSM").Select
Range("A1:I" & lastrow).Copy
Sheets("Sheet1").Select
Range("A1" & lastrow).PasteSpecial (xlPasteValues)
Sheets("Qry_Hse_Business_BSM").Select
Application.CutCopyMode = False
End Sub
 
Upvote 0
I am sorry, I couldnt understand your problem, but if you are trying to paste on A1 try:

Range("A1").PasteSpecial (xlPasteValues)

in stead of

Range("A1" & lastrow).PasteSpecial (xlPasteValues)
 
Upvote 0
Hi,

I have several things to paste...what i am trying to achieve with help..

is that select A1, but if something is already contained in it, then skip 1 row and paste on the next empty cell.
 
Upvote 0
Try this


Sub Macro1()

lastrow = Range("I65000").End(xlUp).Row
OtherLastRow=Worksheets("Sheet1").Range("A65000").End(xlup).Row+1 'Added this line
Sheets("Qry_Hse_Business_BSM").Select
Range("A1:I" & lastrow).Copy
Sheets("Sheet1").Select
Range("A" & OtherLastRow).PasteSpecial (xlPasteValues) 'Changed this lineSheets("Qry_Hse_Business_BSM").Select
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,021
Members
449,480
Latest member
yesitisasport

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