1

I've created a macro in Excel 10, so that when I click on a button, the selected text is added to the first cell of the first column on the 3rd spreadsheet. Now I'd like to improve it, so that the selected text gets added to the next empty cell of the first column (still on the 3rd spreadsheet).

My macro so far is :

Sub Copy()
    Selection.Copy
    Sheets("Feuil3").Select
    Range("B2").Select
    ActiveSheet.Paste
End Sub
pnuts
  • 58,317
  • 11
  • 87
  • 139
Sam
  • 13,934
  • 26
  • 108
  • 194
  • 1
    To find the last row : http://stackoverflow.com/questions/11169445/error-finding-last-used-cell-in-vba – Siddharth Rout Dec 20 '12 at 10:05
  • 1
    You might also want to see this? http://stackoverflow.com/questions/10714251/excel-macro-avoiding-using-select – Siddharth Rout Dec 20 '12 at 10:06
  • 1
    If you still have troubles after trying to find the last cell in column A, or can't paste the data into that Range, you can always update your code. – Larry Dec 20 '12 at 10:13

1 Answers1

1

You should be able to do it using one line:

Sub Copy()
    Selection.Copy Sheets("Feuil3").Range("B" & Sheets("Feuil3").Range("B" & Sheets("Feuil3").Rows.Count).End(xlUp).Row + 1)
End Sub
Steve
  • 1,620
  • 2
  • 19
  • 33