' Défintion générale des objets Dim ExcelApp As Object Dim ExcelClasseur As Object Dim ExcelFeuille As Object Private Sub Command1_Click() Set ExcelApp = CreateObject("excel.application") ExcelApp.Visible = True Set ExcelClasseur = ExcelApp.Workbooks.Add Set ExcelFeuille = ExcelClasseur.sheets("Feuil1") ExcelFeuille.cells.Item(1, 1).Value = "Machin" ExcelFeuille.cells.Item(2, 1).Value = "Truc" ExcelFeuille.cells.Item(3, 1).Value = "Machine" ExcelFeuille.cells.Item(4, 1).Value = "Machin chose" End Sub Private Sub Command2_Click() ' 1ere methode ExcelFeuille.Range("b1").FormulaR1C1 = "=COUNTIF(C[-1],""<>"""""")-COUNTBLANK(C[-1])" MsgBox ExcelFeuille.Range("b1").Value ' 2ieme methode MsgBox ExcelApp.WorksheetFunction.CountIf(ExcelFeuille.Range("a:a"), "<>") End Sub Private Sub Command3_Click() ExcelApp.quit End Sub
Private Sub Command2_Click() ' 1ere methode ExcelFeuille.Range("b1").FormulaR1C1 = "=COUNTIF(C[-1],""<>"""""")-COUNTBLANK(C[-1])" MsgBox ExcelFeuille.Range("b1").Value ' 2ieme methode MsgBox ExcelApp.WorksheetFunction.CountIf(ExcelFeuille.Range("a:a"), "<>") ' 3ième méthode MsgBox ExcelApp.WorksheetFunction.CountIf(ExcelFeuille.Columns(1), "<>") End Sub
=NB.SI(A:A;"<>""")
=NB.SI(A:A;"<>""")-NB.VIDE(A:A)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question