Consulting

Results 1 to 14 of 14

Thread: Solved: Select line and send to specific fields to another worksheet

  1. #1
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location

    Solved: Select line and send to specific fields to another worksheet

    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/6w9mu3...om/file/6w9mu3
    [VBA]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[/VBA]

    Cross-Post
    http://www.mrexcel.com/forum/excel-q...worksheet.html

  2. #2
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    try attached file
    Attached Files Attached Files

  3. #3
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.

    Msgbox appears when I press the 'ok', then the code does nothing but.

  4. #4
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    check macro assigned to button "Enviar", must be CopySelectedRows

  5. #5
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.

    When running, the InputBox appears, I select the line.
    Then appears a TextBox, I press OK, nothing else happens there!!

    Thank you!!

  6. #6
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    Quote Originally Posted by marreco
    Hi.
    When running, the InputBox appears, I select the line.
    Then appears a TextBox......
    textbox ? attach again your file

  7. #7
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.

    See my file
    Attached Files Attached Files

  8. #8
    Select a name only and then click on a button.

    [VBA]Sub MaybeSometingLikeThis()
    With Sheets("Plan2")
    .Range("G5").Value = ActiveCell.Value
    .Range("F11").Value = ActiveCell.Offset(, 1).Value
    .Range("I5").Value = ActiveCell.Offset(, 2).Value
    .Range("I14").Value = ActiveCell.Offset(, 3).Value
    End With
    End Sub[/VBA]

  9. #9
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    You have to assign macro to button "Enviar", must be CopySelectedRows.
    After that your file works

  10. #10
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.
    I did the assignment happens but as mentioned in my post #5

    Thank you!!

  11. #11
    VBAX Mentor
    Joined
    Jul 2012
    Posts
    398
    Location
    I can't help you, that code works perfect on my Excel 2010, on my Win7, on my PC

  12. #12
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.
    I use Excel 2007, Windows XP, is it therefore that is not working?

  13. #13
    I tried your code from the attachment in #7 and it works for me in XP/2007.
    Did you select the whole row (click on the row number)?

  14. #14
    VBAX Tutor
    Joined
    Jan 2011
    Posts
    272
    Location
    Hi.

    I was not knowing how to use the code.
    the code is working.

    thanks to all

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •