Copy from one worksheet, paste to another worksheet... with a twist

BBY-SPORT

New Member
Joined
Jun 15, 2011
Messages
1
Hi guys,

I've been doing a bunch of looking and I'm so stuck on this it's not funny... so let me go over what I am doing, and lets see if I can't get some help getting over this hurdle.

Okay, so here is the situation...

I am trying to get Excel (2007 by the way) to copy a set range from one worksheet (Notes), to another worksheet (DataFile). This isn't the problem as I can certainly get VBA to do this... I am attempting to have VBA find the first available row to paste to, then to paste the contents.

Now both worksheets are formatted the same way, same amount of columns, same information between the two worksheets.

The range on the Notes worksheet is from A2:R7, this will never change in any way... so here is what I started at:

Code:
Private Sub btnSubmit_Click()

'Select copy range from "Notes" worksheet
Worksheets("Notes").Range(A2:R7).Copy

'Set Variables for empty row
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("DataFile")

'Find first empty row
iRow = ws.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0)
Selection.PasteSpecial

End Sub

Unfortunately, this does not work, and gives me some pesky runtime errors, I am at a loss right now. If anyone can lend a hand and share some knowledge with me please?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to the board. Something like this:

Code:
Private Sub btnSubmit_Click()
Dim iRow As Long

iRow = Sheets("Datafile").Range("B" & Rows.Count).End(xlUp).Offset(1).Row

Sheets("Notes").Range("A2:R7").Copy Sheets("Datafile").Cells(iRow, 2)

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,843
Members
452,948
Latest member
UsmanAli786

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