marreco
08-23-2012, 04:27 PM
Hi.
I need to select one of the rows in spreadsheet 1, to Sheet2
But the fields will always Sheet2 cells
G5
F11
I5
I14
I tried to use it but is not working....http://www.sendspace.com/file/6w9mu3http://www.sendspace.com/file/6w9mu3
Sub CopySelectedRows()
Dim rCopy As Range
Dim lAreas As Long
On Error Resume Next
Set rCopy = Application.InputBox("Select Rows to copy. " _
& "Use Ctrl for non-contiguous rows", "COPY ROWS", Selection.Address, , , , , 8)
On Error GoTo 0
If rCopy Is Nothing Then Exit Sub 'Hit Cancel
If rCopy.Columns.Count <> Columns.Count Then
MsgBox "Please select entire row(s)"
Run "CopySelectedRows"
Else
For lAreas = 1 To rCopy.Areas.Count
rCopy.Areas(lAreas).Copy Sheet2.Cells(Rows.Count, 1).End(xlUp)(2, 1)
Next lAreas
End If
End Sub
Cross-Post
http://www.mrexcel.com/forum/excel-questions/654765-select-line-send-specific-fields-another-worksheet.html
I need to select one of the rows in spreadsheet 1, to Sheet2
But the fields will always Sheet2 cells
G5
F11
I5
I14
I tried to use it but is not working....http://www.sendspace.com/file/6w9mu3http://www.sendspace.com/file/6w9mu3
Sub CopySelectedRows()
Dim rCopy As Range
Dim lAreas As Long
On Error Resume Next
Set rCopy = Application.InputBox("Select Rows to copy. " _
& "Use Ctrl for non-contiguous rows", "COPY ROWS", Selection.Address, , , , , 8)
On Error GoTo 0
If rCopy Is Nothing Then Exit Sub 'Hit Cancel
If rCopy.Columns.Count <> Columns.Count Then
MsgBox "Please select entire row(s)"
Run "CopySelectedRows"
Else
For lAreas = 1 To rCopy.Areas.Count
rCopy.Areas(lAreas).Copy Sheet2.Cells(Rows.Count, 1).End(xlUp)(2, 1)
Next lAreas
End If
End Sub
Cross-Post
http://www.mrexcel.com/forum/excel-questions/654765-select-line-send-specific-fields-another-worksheet.html