What is function to select only not empty cells in a column (like SHIFT+END+ArrowDown or UP)

M

mar_male

I want to select only cells with something inside not empty. For
example:
I want to find a function in VBA witch work like SHIFT+END+"ArrowDown
or Up"
I have
_____A_____B____
1 | string | |
2 | string | |
3 | string | |
4 | string | |
...........................
40| string | |
41| | |
Cell A41 is empty
I want to select only cells from A1 to A40 , but I dont want to use
something like this (from
Cells A1 to Cells A40 Select) I want to find a function which will do
it automaticaly without
enetering number of cells like from A1 to A40 Select.
Do you know is there a special function in Excel.
If you write some text in column A like mentioned above and go with
cursor on cel A1 than
turn holdSHIFT+ END + DownArrow than it select cells witch text inside
from A1 to A40, how to do something like this in VBA??
Thank you for response
 
K

Kalpesh

Well, pressing shift+ end + dnarrow works on empty cells as well.
However, for your scenario - you could do the following

cells(1,1).select 'goes to A1
range(activecell,activecell.End(xlDown)).Select 'selects the cell till
the last filled cell in the col.

So, what you need is activecell.end(xlDown).

HTH
Kalpesh
 
M

mar_male

Hello
How can I do something like this I want to add to all cells in range
Range("A:A").SpecialCells(xlCellTypeConstants) a prefix string like UT_
for example. I know there is a "character" but how i can use it for ma
Range
____A_____B____
1 | UT_string | |
2 | UT_string | |
3 | UT_string | |
4 | UT_string | |
...........................
40| UT_string | |
41| | |
Thanks for response
 
M

mar_male

Hello
How can I do something like this I want to add to all cells in range
Range("A:A").SpecialCells(xlCellTypeConstants) a prefix string like UT_
for example. I know there is a "character" but how i can use it for ma
Range
____A_____B____
1 | UT_string | |
2 | UT_string | |
3 | UT_string | |
4 | UT_string | |
...........................
40| UT_string | |
41| | |
Thanks for response
 

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

Top