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

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
I dont know if it will help but try to change:
Code:
 Range("A1:I1" & lastrow).Copy
to
Code:
Range("A1:I" & lastrow).Copy
 

Roses8

Active Member
Joined
Aug 4, 2005
Messages
348
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
 

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
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)
 

Roses8

Active Member
Joined
Aug 4, 2005
Messages
348

ADVERTISEMENT

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.
 

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,647
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,548
Messages
5,838,038
Members
430,527
Latest member
MyFace2

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
Top