Consulting

Results 1 to 3 of 3

Thread: Move cells to another worksheet

  1. #1

    Move cells to another worksheet

    Good afternoon everyone,


    I need a VBA code where I can on Sheet1 select a cell and by giving 02 clicks it moves the contents of the selected cell plus 02 cells to the right for Sheet2.
    Example: If I have cell A10 selected and give 2 clicks move the range A10: C10 to sheet2, remembering that on sheet2 it should be stored below the last line.


    Thank you one more time.

  2. #2
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    if you put this routine in the sheet 1 before double click it should work;

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim inarr As Variant
    With Worksheets("sheet2")
     inarr = Target.Resize(, 3)
     lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
     .Range(.Cells(lastrow + 1, 1), .Cells(lastrow + 1, 3)) = inarr
     
    End With
    End Sub

  3. #3
    Good evening,

    It would be like giving 2 clicks to move the content to Sheet2, adding after the last line filled.


    Thanks a lot for the help

Posting Permissions

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