Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-01-2021, 04:36 PM
Guessed's Avatar
Guessed Guessed is offline Counting numbers in Word VBA Windows 10 Counting numbers in Word VBA Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I think you need to iterate through the array and test each value


Code:
Sub CountIt()
  Dim arr() As String, i As Integer, iCount As Integer
  arr = Split("1,Dog,2,Apple,3.7,22,Green", ",")
  For i = LBound(arr) To UBound(arr)
    If IsNumeric(arr(i)) Then iCount = iCount + 1
  Next i
  MsgBox "Array contains " & iCount & " numbers", vbOKOnly
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
count, counta

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting footnotes in Word Sylvain Word VBA 0 03-10-2021 06:45 AM
Counting Consecutive Periods In Rows Using Numbers Yaaseen23 Excel 18 03-24-2017 11:15 AM
counting "x" in a cell and sum the numbers in weekday rayramirezdvm Excel 4 04-02-2015 02:58 PM
Counting unique visitors by ward, counting monthly visits by status, editing existing workbook JaxV Excel 9 11-14-2014 12:25 AM
Word counting macro for newly added portion? New Daddy Word VBA 24 09-30-2013 07:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft