OVH Cloud OVH Cloud

Select FUNCTION in VBA Excel

4 réponses
Avatar
mar_male
Hello,
I am beginner in programing in VBA EXCEL and I am looking for a
function which selects only filled cells (not all cells in columns with
empty cells). Or function which doing something like combination of
SHIFT+END+"arrow down".
I can do this by using FOR and ISEmpty function and select cells until
first empty.
But is there easiest way to do something like this.

Thanks for response
Marcin

4 réponses

Avatar
Pounet95
Hello,
I think undestand you want to know the last cell empty in a column ?
in VBA you can use this :

End_Row_In_Column_A=range("A65536").End(xlup).row+1

But, perhaps in don't undestand well your question ????
My school level is 6th ;o(((((

For French : suis preneur sur tout commentaire, même désobligeant, sur mon
niveau d'Anglais ;o)))))))
surtout pour vérifier si j'ai bien compris la question !

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:

Hello,
I am beginner in programing in VBA EXCEL and I am looking for a
function which selects only filled cells (not all cells in columns with
empty cells). Or function which doing something like combination of
SHIFT+END+"arrow down".
I can do this by using FOR and ISEmpty function and select cells until
first empty.
But is there easiest way to do something like this.

Thanks for response
Marcin



Avatar
mar_male
Pounet95 wrote:
Hello,
I think undestand you want to know the last cell empty in a column ?
in VBA you can use this :

End_Row_In_Column_A=range("A65536").End(xlup).row+1

But, perhaps in don't undestand well your question ????
My school level is 6th ;o(((((

For French : suis preneur sur tout commentaire, même désobligeant, sur mon
niveau d'Anglais ;o)))))))
surtout pour vérifier si j'ai bien compris la question !

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:

Hello,
I am beginner in programing in VBA EXCEL and I am looking for a
function which selects only filled cells (not all cells in columns with
empty cells). Or function which doing something like combination of
SHIFT+END+"arrow down".
I can do this by using FOR and ISEmpty function and select cells until
first empty.
But is there easiest way to do something like this.

Thanks for response
Marcin




I want to select only cells with something inside not empty. For
example:
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


Avatar
michdenis
Bonjour ,

Range("A:A").SpecialCells(xlCellTypeConstants).Select


Salutations!



a écrit dans le message de news:

Pounet95 wrote:
Hello,
I think undestand you want to know the last cell empty in a column ?
in VBA you can use this :

End_Row_In_Column_A=range("A65536").End(xlup).row+1

But, perhaps in don't undestand well your question ????
My school level is 6th ;o(((((

For French : suis preneur sur tout commentaire, même désobligeant, sur mon
niveau d'Anglais ;o)))))))
surtout pour vérifier si j'ai bien compris la question !

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:

Hello,
I am beginner in programing in VBA EXCEL and I am looking for a
function which selects only filled cells (not all cells in columns with
empty cells). Or function which doing something like combination of
SHIFT+END+"arrow down".
I can do this by using FOR and ISEmpty function and select cells until
first empty.
But is there easiest way to do something like this.

Thanks for response
Marcin




I want to select only cells with something inside not empty. For
example:
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


Avatar
Pounet95
Hello,
First, iI want scuse me for my very bad English.
I speack ( and write ) English like 'a little negro' ( in French : "Parler
petit nègre" )

Try this macro you can save in your Perso.xls ( with a shortcut like Ctrl w
for example )

Sub Select_Until_Last_Row_In_Column()
Dim celFirst As Range
Dim celEnd As Range
'the first cell in the active column ....
Set celFirst = Cells(1, ActiveCell.Column)
' the last cell in this same column
Set celEnd = Cells(Cells(65536, ActiveCell.Column).End(xlUp).Row,
ActiveCell.Column)
' from the first cell to the last not empty
Range(celFirst, celEnd).Select
End Sub

Attention : if, between the first cell and the last cell in the column, one
cell or more are empty, they are also include in the selection !!!

Pour les français qui liront ( et comprendrons mon franglais ) :
Qu'en pensez-vous ? ( de ma compréhension de la question et de la réponse
fournie )
Dans le cas positif je promets de ne pas faire le tour de la ville en slip
( idem dans le cas contraire )
......... bien que ce soit chaud en ce moment, la nuit surtout, dans ma
banlieue ;o((((((

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:


Pounet95 wrote:
Hello,
I think undestand you want to know the last cell empty in a column ?
in VBA you can use this :

End_Row_In_Column_A=range("A65536").End(xlup).row+1

But, perhaps in don't undestand well your question ????
My school level is 6th ;o(((((

For French : suis preneur sur tout commentaire, même désobligeant, sur
mon
niveau d'Anglais ;o)))))))
surtout pour vérifier si j'ai bien compris la question !

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/
Conseillé :
http://dj.joss.free.fr/netiquet.htm
(charte, nétiquette, conseils, abréviations, souriettes...)
http://www.excelabo.net/mpfe/connexion.php
(connexion, conseils...)

a écrit dans le message de news:

Hello,
I am beginner in programing in VBA EXCEL and I am looking for a
function which selects only filled cells (not all cells in columns with
empty cells). Or function which doing something like combination of
SHIFT+END+"arrow down".
I can do this by using FOR and ISEmpty function and select cells until
first empty.
But is there easiest way to do something like this.

Thanks for response
Marcin




I want to select only cells with something inside not empty. For
example:
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