Consulting

Results 1 to 3 of 3

Thread: Solved: need help with command button

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    43
    Location

    Solved: need help with command button

    I need a command button that will copy a cell to the next available cell in another worksheet.

    So, lets say sheet 1, a1 is the cell to be copied. On sheet 2 I have a range, say, a1-a100. When I hit the command button I need it to look at sheet 2, a1-a100 and find the first empty cell. Then put the contents of sheet 1, a1 in it.

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    use it with a button or whatever you like![vba]ActiveCell.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)[/vba]if you want to copy the whole row then:
    [vba]
    ActiveCell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    [/vba]
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    43
    Location
    Thanks, both worked perfect.

Posting Permissions

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