ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count the #of ISTEXT cells (https://www.excelbanter.com/excel-programming/389175-count-istext-cells.html)

Filo

Count the #of ISTEXT cells
 
Could you help me with the VB code that would perform the following?

Count the number of cells that have text in a range that goes from the
active cell to .End(xlRight)

Thank you!

cory

Count the #of ISTEXT cells
 
Filo - give this a try. It counts the total number of cells and then
subtracts the number of cells that contain numbers.

Sub CountText()

Dim Count As Integer

Count = Range(ActiveCell, ActiveCell.End(xlToRight)).Cells.Count
Count = Count - WorksheetFunction.Count(Range(ActiveCell,
ActiveCell.End(xlToRight)))
MsgBox "There are " & Count & " cells containing text."

End Sub

-Cory

"Filo" wrote:

Could you help me with the VB code that would perform the following?

Count the number of cells that have text in a range that goes from the
active cell to .End(xlRight)

Thank you!


Filo

Count the #of ISTEXT cells
 
It worked. Thank you!

"Cory" wrote:

Filo - give this a try. It counts the total number of cells and then
subtracts the number of cells that contain numbers.

Sub CountText()

Dim Count As Integer

Count = Range(ActiveCell, ActiveCell.End(xlToRight)).Cells.Count
Count = Count - WorksheetFunction.Count(Range(ActiveCell,
ActiveCell.End(xlToRight)))
MsgBox "There are " & Count & " cells containing text."

End Sub

-Cory

"Filo" wrote:

Could you help me with the VB code that would perform the following?

Count the number of cells that have text in a range that goes from the
active cell to .End(xlRight)

Thank you!



All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com