Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a cell based on count function

Status
Not open for further replies.

remeng

Technical User
Jul 27, 2006
520
US
I can't recall how to count the filled rows in a column and then select the count + 1 cell. This is what I started with.

Code:
Sub countrange() 'value of cells in column A:A

countrange = Count("A:A")
n = countrange + 1
Cell.Select = ("A" + n)

example:

column A
1 bob
2 fred
3 pat

countrange = 3
n = 4

I want to select cell "A4"

Thanks!
 
hi,
code]
cells(1,1).end(xldown).offset(1).select
[/code]
But I would add...

1. Why don't you have a heading on your column of data? It's a good habit to get into.
2. Why Select or Activate anything? This slows down performance. REFERENCE the cell or range instead.
Code:
with cells(1,1).end(xldown).offset(1)
   'now do stuff with this cell, like assign a value
   .value = "SkipVought"
   .font.bold = true
end with

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top