0
votes

Please I need some help with how to add text to the last (empty) row in a column using VBA?

I have a spreedsheet with an ActiveX Control button on it. I want that on clicking the command button, Excel takes the text contained in say, cell C3, and add it to the last (empty) row of column A.

Please note that Column A already contains text in various cells. What I want to do is find the last empty cell and then transfer the text from cell C3 to this last empty row. Thank you.

2

2 Answers

2
votes

Assign this macro to your button:

Sub ButtonCode()
   Dim N As Long
   N = Cells(Rows.Count, "A").End(xlUp).Row + 1
   Cells(N, "A").Value = Range("C3").Value
End Sub

It will locate the first empty cell below all data in column A and place the C3 value in it.

0
votes

Try code such as the following:

Sub MoveFromCToA()
    Cells(rows.count,1).end(xlup).offset(1).value = cells(3,3)
End Sub