Copying rows from several worksheets to a single row in one worksheet

starchildren3317

New Member
Joined
May 17, 2011
Messages
6
I am greeted with a Run-Time Error 1004: Application defined or Object defined error message when running the following code:

What I am trying to do is copy the first row of the second, third, and fourth worksheet to the first row of the first worksheet:

Code:
Dim UsedInfo As Long
Dim InputRow As String

'Copy the first Row on Sheet 2 into first Row on Sheet 1
With Worksheets(2).Range("A1")
    .Range(.Cells(1), .End(xlToRight)).Copy Destination:=Worksheets("AppSelect").Range("A1")
End With

'Count number of cells in row
UsedInfo = ActiveWorkbook.ActiveSheet.UsedRange.Cells.Count
UsedInfo = UsedInfo + 1
InputRow = CStr(UsedInfo)

'Copy the first Row on Sheet 3 into first Row on Sheet 1, Starting where the first copy left off
[B]With Worksheets(3).Range("A1")
    .Range(.Cells(1), .End(xlToRight)).Copy Destination:=Worksheets("AppSelect").Range("A" & "InputRow")[/B]
End With

'Count number of cells in row
UsedInfo = ActiveWorkbook.ActiveSheet.UsedRange.Cells.Count
UsedInfo = UsedInfo + 1
InputRow = CStr(UsedInfo)

'Copy the first Row on Sheet 4 into first Row on Sheet 1, Starting where the second copy left off
With Worksheets(4).Range("A1")
    .Range(.Cells(1), .End(xlToRight)).Copy Destination:=Worksheets("AppSelect").Range("A" & "InputRow")
End With

The error happens on the Bolded line of code above.

Any ideas what I am doing wrong?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try using InputRow without the quotes.

Code:
With Worksheets(3).Range("A1")
    .Range(.Cells(1), .End(xlToRight)).Copy Destination:=Worksheets("AppSelect").Range("A" & InputRow)
End With
 
Upvote 0

Forum statistics

Threads
1,224,557
Messages
6,179,503
Members
452,917
Latest member
MrsMSalt

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