Menu principal
Moteur de recherche
Rechercher
Menu principal
Forum
Bureautique
Développement
Internet
Jeux vidéo
Matériel
Réseau
Vidéo/TV
Virus/Sécurité
CCM
CCM - Comment Ça Marche - Communauté informatique
Moteur de recherche
Rechercher
Connexion
Posez votre
question
Informatique
Mobile
Applis & Sites
Image & Son
Maison
Securité
Téléchargement
Forum
Bureautique
Développement
Internet
Jeux vidéo
Matériel
Réseau
Vidéo/TV
Virus/Sécurité
Emploi
Forum
View original (French)
[VBA Excel] count non-empty cells in a column
Raph
-
ensatien -
10 Aug 2016 at 14:24
Hello,
How to know the number of non-empty cells in column A for example in sheet1?
It's easy with the function NB.Si, but in VBA?
Does anyone have an idea?
Thank you
Raph
Configuration:
Windows XP Internet Explorer 6.0
Show more
Liens connexes:
Count cells after applying an Excel filter
VBA cell row number
line break code in VBA Excel
NB.IF color criteria
Calculate number of lines VBA
EXCEL: Remove empty rows at the end
2 réponses
Réponse 1 / 2
xjl
Posted messages
232
Status
Membre
183
Hello,
You can do this:
Sub counting()
n = 0
For Each Cell In Sheets(1).Columns(1).Cells
If IsEmpty(Cell) Then n = n + 1
Next Cell
MsgBox n
End Sub
Raph
Thank you Xjl, I found a shorter one ;)
nbcells = Application.WorksheetFunction.CountA(Sheet1.Range("$A:$A"))
hammougua
Ab44 July 25, 2009 at 1:15 PM
and what would you do for column B?
and how do you declare nbcells?
Gotts
Dim nbcells As Integer
and for B, you just need to replace the A's with B's...
Réponse 2 / 2
Ab44
and for a column B, what would you do?
and how do you declare nbcells?
Padawan_95
Posted messages
9
Status
Membre
Hello,
For a non-empty column specifically? What can we replace "IsEmpty" with?
Thanks in advance,
Padawan95
ensatien
for non-empty cells instead of using IsEmpty, we replace it with Not IsEmpty
Afficher toute la discussion
Latest Discussions
Access issue to my "contact me" profile
at 07:47
Windows spotlight is not working.
on 20 May
Samsung j5 unable to answer
on 19 May
My nikon coolpix s3000 won't turn on anymore.
on 19 May
Bug with the "backspace" key
on 19 May
Do you know maillotsofficiels.fr?
on 19 May
Wii balance board issues
on 19 May
Focusing issue on canon eos 450d
on 19 May
Why do i need to press f1 to start
on 19 May
Wi-fi connection via livebox
on 19 May
Other languages
🇫🇷
Français
nbcells = Application.WorksheetFunction.CountA(Sheet1.Range("$A:$A"))
and what would you do for column B?
and how do you declare nbcells?
and for B, you just need to replace the A's with B's...