last row value in a range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Have a userform in this form i have a textfield
i want to take the last row with value from a sheet into this field

regards alvin
 
Hello Alvin,

Here is an example. The data is in column "A" on "Sheet1". The TextBo
on the UserForm is TextBox1.


LastRow = Application.WorksheetFunction.CountA("A:A")

TextBox1.Text = Sheets("Sheet1").Cells(LastRow, 1)

_________________________________________________________________

The CountA function counts any type of information, including empt
text ("") but not including empty cells. If an argument is an array o
reference, empty cells within the array or reference are ignored. I
you do not need to count logical values, text, or error values, use th
COUNT function.

Also, when changing your column from "A" to whatever, Cells functio
reference is Cells(Row, Column).
_________________________________________________________________

Hope this helps,
Leith Ros
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top