Copy and Paste Problem

kalumbair

New Member
Joined
Aug 2, 2018
Messages
35
Hello Everyone,

i'd like to copy the entire last row of a sheet called ("HL_1") and pasted it to another sheet called ("HL_COMBINED"). I should also point out that they are both table formatted. the code i'm using is below, but it's just not working. any assistance is greatly appreciated.

Private Sub CommandButton1_Click()
Dim i, LastRow
LastRow = Sheets(?HL_1?).Cells(Rows.Count).End(xlUp).Row

For i = 2 To LastRow
If Sheets(?HL_1?).Cells(i, ?A?).Value = ?? Then
Sheets(?HL_1?).Cells(i, ?A?).EntireRow.Copy Destination:=Sheets(?HL_COMBINED?).Range(?A? & Rows.Count).End(xlUp).Offset(1)
End If
Next i
End Sub
 
Re: Code Error Run Time erro 13

@kalumbair, I thought we had established in your other thread that your table name was Table2 and not HL_COMBINED?

What line are you getting the error on?

Btw why have you hijacked someone else's thread (which is about another error number) rather than continuing in your old thread or starting a new one?
Old thread
 
Last edited:
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Re: Code Error Run Time erro 13

Mark858,

the code was working just fine when I ran it on a test sheet, but when I applied to the actual sheet, it all went to hell. and sorry to hijack someone else's thread. i'm new to forum life and i'm not too savvy with all the rules and protocalls. my apologies, it won't happen again.

v/
 
Upvote 0
Re: Code Error Run Time erro 13

Do you have any protection or merged cells on the sheet? and you haven't answered the question about which line it errors out on.

Btw, there are links to the forum rules and posting guidelines in my signature block below, they should help with familiarizing yourself with forum life.
 
Upvote 0
Re: Code Error Run Time erro 13

Copy on the rules and guidelines, thx.
The sheet is not protected or have merged cells. The error I received when I applied the code to the new sheet is 1004 application defiened or object defiened.


Do you have any protection or merged cells on the sheet? and you haven't answered the question about which line it errors out on.

Btw, there are links to the forum rules and posting guidelines in my signature block below, they should help with familiarizing yourself with forum life.
 
Upvote 0
Re: Code Error Run Time erro 13

and the below :biggrin:
and you haven't answered the question about which line it errors out on.
 
Upvote 0
Re: Code Error Run Time erro 13

@kalumbair
As has been mentioned by MARK858 please do not "hijack" other peoples threads.
I have moved these posts to your own thread
 
Upvote 0
Re: Code Error Run Time erro 13

Cross posted https://www.excelforum.com/excel-pr...and-paste-to-different-sheet.html#post4949416

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
Re: Code Error Run Time erro 13

again, my apologies.

Cross posted https://www.excelforum.com/excel-pr...and-paste-to-different-sheet.html#post4949416

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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