Sam
Sam

Reputation: 14586

Excel 10 - Writing text to next cell

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

Upvotes: 1

Views: 250

Answers (1)

Steve
Steve

Reputation: 1638

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

Upvotes: 1

Related Questions